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

Confused on small script that changes jump height, Any ideas?

Hi I am struggling to make the Jump height increase when the The tool is equipped, any ideas on how this could be fixed?:

local Tool = script.Parent
local Jump = 150
local NormJump = 50

Tool.Equipped:Connect(function()
	local humanoid =  Tool.Parent:FindFirstChild("Humanoid")
	
	if humanoid then
		humanoid.JumpPower = Jump
	end
end)

Tool.Unequipped:Connect(function()
	local humanoid = Tool.Parent.Parent.Character:FindFirstChild("Humanoid")
	
	if humanoid then
		humanoid.JumpPower = NormJump
	end
end)

Thanks for helping (if you are helping)

1 comment

0

Script or LocalScript?

2 answers

✓ Accepted answer

Your welcome!

Explorer --> StarterPlayer --> Properties --> Character Jump Settings --> Character Use Jump Power = true

If I helped you please mark my answer as best

3 comments

0

ok

0

tysm ur a life saver

0

glad i helped you dude :)

Make sure this is a normal script I think the issue could be that using local Jump = 150 I fixed your script. Also the other issue I found is that you use different amount of .Parent in your script when it should be the same amount


Tool.Unequipped:Connect(function()
    local humanoid = Tool.Parent.Parent.Character:FindFirstChild("Humanoid")-- This line has 2 Parent
Tool.Equipped:Connect(function()
    local humanoid =  Tool.Parent:FindFirstChild("Humanoid")-- this one only has 1 

You need to make sure the have the same amount so its either 2 Parent or 1 fix it in the script below

Final

local Tool = script.Parent

Tool.Equipped:Connect(function()
    local humanoid =  Tool.Parent:FindFirstChild("Humanoid")

    if humanoid then
        humanoid.JumpPower = 150
    end
end)

Tool.Unequipped:Connect(function()
    local humanoid = Tool.Parent.Parent.Character:FindFirstChild("Humanoid")

    if humanoid then
        humanoid.JumpPower = 50
    end
end)

4 comments

0

sorry but ur both incorrect

0

sorry but ur both incorrect

0

sorry but ur both incorrect

0

Um the answer you accepted does not set the jump height when tool is equipped

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