Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how is spawnlocation touching spawnlocation?

script.Parent.Humanoid.Touched:Connect(function(g)
	if g.Parent.Humanoid.Name == "Humanoid" then
		local d =game.Players:GetPlayerFromCharacter(g)
		d.Team = game.Teams["not game"]
	end
end)

it gives an error that "humanoid is not a valid member of spawn location" and it will not run ever after that error. it doesn't even work when I move the spawn location up. this is the only spawn location block.

1 answer

Try :FindFirstChild!

Like this,

script.Parent.Humanoid.Touched:Connect(function(g)
    if g.Parent:FindFirstChild("Humanoid") then
        local d =game.Players:GetPlayerFromCharacter(g)
        d.Team = game.Teams["not game"]
    end
end)

It would check if Humanoid is a valid member of g.Parent which is your character.

1 comment

1

i found the error, its the humanoid thats there on line 1, but it still doesnt change the team to not game

This discussion is preserved as it was. New answers, comments, and votes are closed.