User:Anaminus/Script:VIPWep

From Legacy Roblox Wiki
Revision as of 01:06, 6 July 2008 by >Anaminus
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
--Anaminus

permission = {"Anaminus"}

function check(player)
	if table.maxn(permission)==0 then return true end--Remove all names from permission to allow all players to use.
	for i = 1,#permission do
		if string.lower(player.Name)==string.lower(permission[i]) then return true end
	end
	return false
end


function onPlayerRespawned(newPlayer)

	if (newPlayer == nil) then return end

	if not check(newPlayer) then return end

	local w = game.Lighting:GetChildren()
	for i = 1,#w do
		if w[i].className == "Tool" or w[i].className == "HopperBin" then
			w[i]:Clone().Parent = newPlayer.Backpack
		end
	end
end

function onPlayerEntered(newPlayer)
	newPlayer.Changed:connect(function (property)
		if (property == "Character") then
			onPlayerRespawned(newPlayer)
		end
	end)
end

game.Players.PlayerAdded:connect(onPlayerEntered)