So I'm doing Workspace:WaitForChild(player.Name) to wait to see if their character spawned. If it doesn't spawn within 60 seconds, I want to stop waiting for child and player:Kick(). How can I do this?
function customWaitForChild(parent, child, WaitTime) local waited = 0 repeat if waited > WaitTime or parent:FindFirstChild(child) then --If it's been going for too long, or if there is a child with the name specified by child, return parent:FindFirstChild(child) --Return the child, if it exists, or nil. end waited = waited + wait(0) --Add a wait to the time waited until nil end --Something like this should work, this is untested.
I don't think that will work. Because the waitforchild waits for the person to spawn but you can't assign it a time I think.