Answered by
5 years ago Edited 5 years ago
I can't say for sure because PlayerGui should be reset on death anyways but I am assuming that it is erroring because you are declaring the humanoid variable one time. After the player dies, their character is deleted and respawned which means that the humanoid value is now nil
01 | local main = script.Parent |
02 | local walkbtn = main.EnterTextBtn |
03 | local jumpbtn = main.EnterTextBtn 2 |
04 | local player = game.Players.LocalPlayer |
05 | local amount = main.Amount |
07 | walkbtn.MouseButton 1 Down:connect( function () |
08 | if player.Character and player.Character:FindFirstChildOfClass( "Humanoid" ) then |
09 | player.Character:FindFirstChildOfClass( "Humanoid" ).WalkSpeed = tonumber (amount.Text) |
13 | jumpbtn.MouseButton 1 Down:connect( function () |
14 | if player.Character and player.Character:FindFirstChildOfClass( "Humanoid" ) then |
15 | player.Character:FindFirstChildOfClass( "Humanoid" ).JumpPower = tonumber (amount.Text) |