Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how is spawnlocation touching spawnlocation?

Asked by 3 years ago
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

Log in to vote
0
Answered by 3 years ago

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
i found the error, its the humanoid thats there on line 1, but it still doesnt change the team to not game fullguyblox3 69 — 3y
Ad

Answer this question