✓ Accepted answer
Died event
assuming this is a local script
Well, the Died event isn't a function but rather an event, which means the current way you are doing things would error
Because it is an event, it must be formatted like :
humanoid.Died:Connect(function()
...
end)
rather than what you did.
A couple of other things to note here :
Humanoid is a child of the player's character, not of the player itself.
Modifying the player's team on a local script, which doesn't work with FE.
You placed a local script outside the player/character which means it doesn't run.
Finished Product
With all that said, here is the finished product.
for _,plr in pairs(game.Players:GetPlayers()) do
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char.Humanoid
hum.Died:Connect(function()
if plr.Team == game.Teams.Players then
plr.Team = game.Teams.Lobby
end
end)
end
Notice that this shouldn't be on a local script, which means the script doesn't have access to the local player, and since the use of RemoteEvents could be exploited in this case, it is best to handle everything on a server script.
Hopefully this helped!
btw, this isn't a complete script (obviously)
3 comments
I have really low Rep because I had to deactivate my account twice and nobody gives an Answer but only give Comments
Do you already have the team service added?
Obviously