How would I make this script work? It keeps saying something about badges and the roblox server

-------------------
--| WaitForChild |--
--------------------

-- Waits for parent.child to exist, then returns it
local function WaitForChild(parent, childName)
	assert(parent, "ERROR: WaitForChild: parent is nil")
	while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
	return parent[childName]
end

-----------------
--| Variables |--
-----------------

local GamePassService = Game:GetService('GamePassService')
local PlayersService = Game:GetService('Players')
local InsertService = Game:GetService('InsertService')
local LightingService = Game:GetService('Lighting') --TODO: Use new data store service once that exists

gamepassid = 156137078

-----------------
--| Functions |--
-----------------

-- When a player with the game pass joins, give them the admin tools
local function OnPlayerAdded(player)
	if GamePassService:PlayerHasPass(player, gamepassid) then
		player.CharacterAdded:connect(
		function()
			wait(1)
			player.Character.Humanoid.WalkSpeed = 200
		end
		)
	end
end

PlayersService.PlayerAdded:connect(OnPlayerAdded)

2 comments

0

You know, there's a WaitForChild on the C side. http://wiki.roblox.com/index.php?title=API:Instance/WaitForChild

0

I got this script from ROBLOX models. It's not functioning for some reason.