Error: "attemping to index local 'player' (a nil value) "
local debounce = true
script.Parent.Touched:Connect(function(hit)
if debounce == true then
print("debounce is turning off")
debounce = false
local player = game.Players:GetPlayerFromCharacter(hit.Parent) -
for i,v in pairs(game.Players:GetPlayers()) do with a for loop
if v.Name == player.Name then
print("Found player "..v.Name)
if v.TeamColor ~= BrickColor.new("Really red") then
print("Not in this team")
v:LoadCharacter()
debounce = true
else
print("You are on this team")
debounce = true
end
end
end
end
end)

1 comment
Why is there a dash on line 8 and why is there 'do with a for loop' on line 9