game.Players.PlayerAdded:Connect(function(player) print(player.name "joined") if not player.Character then print("waiting for character") player.CharacterAdded:wait(); char = player.Character else char = player.Character end end) local hum = char.humanoid hum.died:Connect(function() player:kick() end) game.Players.PlayerAdded:Connect(function(player) player:kick() end)
to get humanoid you should do this >
local hum = char:WaitForChild("Humanoid") -- waits until Humanoid appears and won't be a nil value, also its "Humanoid" with capital H
to fix line 2 you should do this >
print(player.name.. " joined") -- ".." connects 2 strings
fixed script :
game.Players.PlayerAdded:Connect(function(player) print(player.name.. " joined") if not player.Character then print("waiting for character") player.CharacterAdded:wait(); char = player.Character else char = player.Character end end) local hum = char:WaitForChild("Humanoid") hum.Died:Connect(function() player:kick() end) game.Players.PlayerAdded:Connect(function(player) player:kick() end)