The issue is the player’s humanoid is not yet loaded into the game. You just have to add a WaitForChild whne getting the character’s humanoid. In this case your revised script would be as such:
local button = script.Parent
local Players = game.Players.LocalPlayer
local jumpBoost = Players.Character:WaitForChild("Humanoid")
local box = script.Parent.Parent.JumpBox
button.MouseButton1Click:Connect(function()
jumpBoost.JumpPower = (tonumber(box.Text))
end)
This works as I have tested it.
Please don’t forget to mark this as the solution if it works!
This is not necessary. The script just needs to wait for the humanoid to load. The only other way you could incorrectly fix the issue would be to place the local jumpboost inside the function. However, this is inefficient.
Calling WaitForChild on the humanoid is not necessary, nor does the script need to wait for the humanoid to load.
The script is not getting the humanoid or changing the jump power until you press the button.
It shouldn’t need to get the Humanoid every single time you press the button, just once. Waiting for it to exist makes more sense than grabbing it whenever you press a button, especially since you can probably press the button before the character is fully initialized.
You also may want to add a max jump power limit to this like so:
local button = script.Parent
local Players = game.Players.LocalPlayer
local jumpBoost = Players.Character:WaitForChild("Humanoid")
local box = script.Parent.Parent.JumpBox
local maxPower = 500 --Whatever you want the max jump power to be
local maxMessage = "EXEEDS MAX POWER" --Whatever you want the max jump power limit message to be
button.MouseButton1Click:Connect(function()
if (tonumber(box.Text))>= maxPower then
box.Text = maxMessage
wait(1)
box.Text = ""
elseif (tonumber(box.Text))<= maxPower then
jumpBoost.JumpPower = (tonumber(box.Text))
end
end)