Trying To make you jump higher when you hold this tool

The title mostly explains it.

I am trying to make it so you jump higher if you have this tool equipped.

function onTouch(part) 
	local humanoid = part.Parent:FindFirstChild("Humanoid") 
	if (humanoid ~= nil) then
	humanoid.JumpPower = 50	
end

script.Parent.Touched:connect(onTouch)

Just do

local Tool = script.Parent
local Power = 75

Tool.Equipped:Connect(function()
    local Character = Tool.Parent
    Character.Humanoid.JumpPower = Power
end)

There’s no need to use a Touched event if you want to hold a Tool, upon equipped the Tool will be parented to the Player’s Character (Or Script > Tool > Character)

5 Likes

Do you want to JumpPower to be reverted when the tool in unequipped?

@IEnforce_Lawz Yes I do

@JackscarIitt your script didnt work

Where did you put the script exactly?

The Child of the Tool.

The Tool is a child of script

This will reset the jump power when they unequip. And the script should be a child of the tool.

local Tool = script.Parent
local Power = 75
local default = 50

Tool.Equipped:Connect(function()
    local Character = Tool.Parent
    Character.Humanoid.JumpPower = Power
end)

Tool.Unequipped:Connect(function()
    local Character = Tool.Parent.Parent.Character
    Character.Humanoid.JumpPower = default
end)
1 Like

The tool needs to be the parent of the script, not the child.

@XdJackyboiiXd21 yep that script works

Thank You

Glad to hear it. Also could you give @JackscarIitt the solution because he wrote most of the script I just added a bit to it.

2 Likes

I did that.

In that case thank you @JackscarIitt too.

2 Likes