Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

JumpPower is not changing upon joining?

I tried putting this in a LocalScript in backpack, screengui, starterplayer/character scripts folder, then in a regular script in serverscriptservice, nothing works.

When in LocalScript, I define player as LocalPlayer, in regular script, I define player in the PlayerAdded function.

It is printing the correct numberValue, there's no errors. But it won't update the JumpPower, it remains at 50.

Here's the code:

game.Players.PlayerAdded:Connect(function(player)

local Saves = player:WaitForChild("Saves")
local char = player.Character
local human = char:WaitForChild("Humanoid")
local JumpPower = human.JumpPower

local bools = {}
bools.jump1 = Saves:WaitForChild("jump1")
bools.jump2 = Saves:WaitForChild("jump2")
bools.jump3 = Saves:WaitForChild("jump3")
bools.jump4 = Saves:WaitForChild("jump4")
bools.jump5 = Saves:WaitForChild("jump5")
bools.jump6 = Saves:WaitForChild("jump6")
bools.jump7 = Saves:WaitForChild("jump7")
bools.jump8 = Saves:WaitForChild("jump8")
bools.jump9 = Saves:WaitForChild("jump9")
bools.jump10 = Saves:WaitForChild("jump10")

local buttons = {}
buttons.jump1 = player.PlayerGui.main.shopFrame.skillsScrolling.jump1
buttons.jump2 = player.PlayerGui.main.shopFrame.skillsScrolling.jump2
buttons.jump3 = player.PlayerGui.main.shopFrame.skillsScrolling.jump3
buttons.jump4 = player.PlayerGui.main.shopFrame.skillsScrolling.jump4
buttons.jump5 = player.PlayerGui.main.shopFrame.skillsScrolling.jump5
buttons.jump6 = player.PlayerGui.main.shopFrame.skillsScrolling.jump6
buttons.jump7 = player.PlayerGui.main.shopFrame.skillsScrolling.jump7
buttons.jump8 = player.PlayerGui.main.shopFrame.skillsScrolling.jump8
buttons.jump9 = player.PlayerGui.main.shopFrame.skillsScrolling.jump9
buttons.jump10 = player.PlayerGui.main.shopFrame.skillsScrolling.jump10

if bools.jump1.Value == true then
	buttons.jump1.Text = "+1%Jump"
	buttons.jump1.BackgroundColor3 = Color3.new(85,170,255)
	script.jump1.Value = 0.5
end

if bools.jump2.Value == true then
	buttons.jump2.Text = "+2%Jump"
	buttons.jump2.BackgroundColor3 = Color3.new(85,170,255)
	script.jump2.Value = 1
end

if bools.jump3.Value == true then
	buttons.jump3.Text = "+3%Jump"
	buttons.jump3.BackgroundColor3 = Color3.new(85,170,255)
	script.jump3.Value = 1.5
end

if bools.jump4.Value == true then
	buttons.jump4.Text = "+4%Jump"
	buttons.jump4.BackgroundColor3 = Color3.new(85,170,255)
	script.jump4.Value = 2
end

if bools.jump5.Value == true then
	buttons.jump5.Text = "+5%Jump"
	buttons.jump5.BackgroundColor3 = Color3.new(85,170,255)
	script.jump5.Value = 2.5
end

if bools.jump6.Value == true then
	buttons.jump6.Text = "+6%Jump"
	buttons.jump6.BackgroundColor3 = Color3.new(85,170,255)
	script.jump6.Value = 3
end

if bools.jump7.Value == true then
	buttons.jump7.Text = "+7%Jump"
	buttons.jump7.BackgroundColor3 = Color3.new(85,170,255)
	script.jump7.Value = 3.5
end

if bools.jump8.Value == true then
	buttons.jump8.Text = "+8%Jump"
	buttons.jump8.BackgroundColor3 = Color3.new(85,170,255)
	script.jump8.Value = 4
end

if bools.jump9.Value == true then
	buttons.jump9.Text = "+9%Jump"
	buttons.jump9.BackgroundColor3 = Color3.new(85,170,255)
	script.jump9.Value = 4.5
end

if bools.jump10.Value == true then
	buttons.jump10.Text = "+10%Jump"
	buttons.jump10.BackgroundColor3 = Color3.new(85,170,255)
	script.jump10.Value = 5
end

JumpPower = 50 + script.jump1.Value + script.jump2.Value + script.jump3.Value + script.jump4.Value + script.jump5.Value + script.jump6.Value + script.jump7.Value + script.jump8.Value + script.jump9.Value + script.jump10.Value
print(JumpPower)

end)

2 answers

✓ Accepted answer

Your line 6, JumpPower = human.JumpPower, makes a new variable called JumpPower and gives it a value equal to human.JumpPower, meaning updating JumpPower has no effect on the JumpPower property of your humanoid. After updating your JumpPower variable, you need another statement that sets the JumpPower property of the humanoid equal to your updated JumpPower variable.

1 comment

0

Thanks. I removed ... local JumpPower and just did human.JumpPower = math stuff. It works now.

Put this in line 2 also, put this in starterplayerscript

for i, plr in pairs(game.Players:GetPlayers()) do
    if plr.Character:WaitForChild("Humanoid") then
        plr.Character.Humanoid.JumpPower = 125 -- change this to your wanted jumpower
    end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.