game:GetService('Players').PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) character:WaitForChild("Humanoid").Died:Connect(function() print(player.Name .. " has died!") local Player = game.Players:GetPlayerFromCharacter(hit.Parent) Player:kick("You died!") end) end) end)
I made this script to detect when you die, then kick you but its not working, can i get help?
Try:
Lastmsg = "(You died)" How = 1 game.Players.PlayerAdded:connect(function (p) local Num = Instance.new("IntValue", p) Num.Name = ("Deaths") p.CharacterAdded:connect(function (c) c.Humanoid.Died:connect(function() Num.Value = Num.Value + 1 local Value = Num.Value if (Value == How) then wait(1) local PlayName = p.Name local msg = Instance.new("Hint", game.Workspace) msg.Text = (PlayName.." Has died, You can only live once.. As known as "..Lastmsg) wait(5) msg:remove() p:remove() wait() end end) end) end)