Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

JumpPower is not changing upon joining?

Asked by 5 years ago

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:

01game.Players.PlayerAdded:Connect(function(player)
02 
03local Saves = player:WaitForChild("Saves")
04local char = player.Character
05local human = char:WaitForChild("Humanoid")
06local JumpPower = human.JumpPower
07 
08local bools = {}
09bools.jump1 = Saves:WaitForChild("jump1")
10bools.jump2 = Saves:WaitForChild("jump2")
11bools.jump3 = Saves:WaitForChild("jump3")
12bools.jump4 = Saves:WaitForChild("jump4")
13bools.jump5 = Saves:WaitForChild("jump5")
14bools.jump6 = Saves:WaitForChild("jump6")
15bools.jump7 = Saves:WaitForChild("jump7")
View all 95 lines...

2 answers

Log in to vote
0
Answered by 5 years ago

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.

0
Thanks. I removed ... local JumpPower and just did human.JumpPower = math stuff. It works now. karinavaaj 22 — 5y
Ad
Log in to vote
0
Answered by
JesseSong 3916 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

Put this in line 2 also, put this in starterplayerscript

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

Answer this question