Set JumpPower by TextBox dosen't work

Hey, i want to make local TextBox when someone type number, intvalue then it sets JumpPower.
I made a basic script but it dosen’t work, someone know what’s it’s wrong with this localscript:

local button = script.Parent
local Players = game.Players.LocalPlayer
local jumpBoost = Players.Character.Humanoid
local box = script.Parent.Parent.JumpBox

button.MouseButton1Click:Connect(function()
    jumpBoost.JumpPower = (tonumber(box.Text))
end)
1 Like

Its because you are setting it in a local script, in this case you should use a remote event.

what? im new on devforum can you explain what I must to do?

Are you getting any error or output on it? Is it a LocalScript or ServerScript?

I deleted the post, I realized I was wrong.

The problem in his case is because of him setting it in a local script. On his case he should add a remote event and do the changing jump power in the server.

Why? The JumpPower can be modified from both the server and the client, however, if you do it from the client, the Server will detect the same JumpPower but the client will see the change and behave differently.
There shouldn’t be any trouble when changing the JumpPower from the client.

1 Like

I mean, when I saw the developer hub in the client-server model this appeared:

1 Like

i don’t get any error in output

The Humanoid.Jump and Humanoid.Sit replicate as the client is mostly supposed to run these functions, but the Humanoid.JumpPower will not replicate to the server and you will detect it like it will, if you try a local script that changes it, it will work, but not if you look at it from the server.

1 Like

Oh well, I just readed the OP again. He should still use remote event in case he wants it replicating to everyone else.

Perhaps try waiting for the Character and Humanoid to appear? If the script runs instantly, then it will surely error with attempt to index with nil, you could replace these variables with this:

local character = Players.Character or Players.CharacterAdded:Wait()
local jumpBoost = character:WaitForChild('Humanoid')

and the function with this:

button.MouseButton1Click:Connect(function()`
    if not character then return end
    jumpBoost.JumpPower = (tonumber(box.Text))
end)

Still nothing display in Output

No it is not because it is a local script.

make sure your pressing the space bar :joy:

script.Parent.MouseButton1Click:Connect(function()
    warn(tonumber(script.Parent.Parent.JumpBox.Text))
    game:GetService("Players").LocalPlayer.Character.Humanoid.JumpPower = tonumber(script.Parent.Parent.JumpBox.Text)
end)

still it dosen’t work for me :c

What is not working?
You are probably doing something wrong.

Do you tested this script in your Roblox Studio?

I don’t need to test it to know it works, but I tested it in studio and it works fine.

hmm, so I don’t know what I’m doing wrong but it doesn’t work for me :frowning:

1 Like