i make a code like this but it fells like it have a error
local TeleportService = game:GetService("TeleportService")
local h = script.Parent.Humanoid
local n = script.Parent
h.Changed:connect(function()
if h.Health <= 0 then -- when the entity died
wait(2)
script.Parent:Destroy()
for i,v in pairs(game.Players:GetPlayers()) do
print(v)
TeleportService:Teleport(5489981012, v) -- teleport back to my game
v:Kick("Lost due to manager is dead. Teleporting to a new game")
end
end
end)

1 comment
What's the error? What part doesn't work