01 | game.Players.PlayerAdded:Connect( function (player) |
02 | print (player.name "joined" ) |
03 | if not player.Character then |
04 | print ( "waiting for character" ) |
05 | player.CharacterAdded:wait(); |
06 | char = player.Character |
07 | else |
08 | char = player.Character |
09 | end |
10 | end ) |
11 | local hum = char.humanoid |
12 | hum.died:Connect( function () |
13 | player:kick() |
14 | end ) |
15 | game.Players.PlayerAdded:Connect( function (player) |
16 | player:kick() |
17 | end ) |
to get humanoid you should do this >
1 | 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 >
1 | print (player.name.. " joined" ) -- ".." connects 2 strings |
fixed script :
01 | game.Players.PlayerAdded:Connect( function (player) |
02 | print (player.name.. " joined" ) |
03 | if not player.Character then |
04 | print ( "waiting for character" ) |
05 | player.CharacterAdded:wait(); |
06 | char = player.Character |
07 | else |
08 | char = player.Character |
09 | end |
10 | end ) |
11 | local hum = char:WaitForChild( "Humanoid" ) |
12 | hum.Died:Connect( function () |
13 | player:kick() |
14 | end ) |
15 | game.Players.PlayerAdded:Connect( function (player) |
16 | player:kick() |
17 | end ) |