#Why when I unequip, the player's jump height remains the same?

1 messages · Page 1 of 1 (latest)

fading marsh
#
local tool = script.Parent

tool.Equipped:Connect(function()
    local humanoid = tool.Parent:FindFirstChild("Humanoid")
    
    if humanoid then
        humanoid.JumpHeight = 15
    end
end)

tool.Unequipped:Connect(function()
    print("Unequippded")
    local humanoid = tool.Parent:FindFirstChild("Humanoid")

    if humanoid then
        humanoid.JumpHeight = 7.2
    end
end)

#

I also checked if the event was firing and it was

clear holly
fading marsh
#

Jump height

clear holly
#

can you make an else check and do a print message inside the else check?

#

like do else for both if checks

clear holly
subtle mapleBOT
#

studio** You are now Level 2! **studio

fading marsh
#

My else statement isnt firing so I guess its supposed to work but just doesnt?

clear holly
#

can u do it for the equipped one too?

fading marsh
#
local tool = script.Parent

tool.Equipped:Connect(function()
    local humanoid = tool.Parent:FindFirstChild("Humanoid")
    
    if humanoid then
        humanoid.JumpHeight = 15
    else
        print("Equipped")
    end
end)

tool.Unequipped:Connect(function()

    local humanoid = tool.Parent:FindFirstChild("Humanoid")

    if humanoid then
        humanoid.JumpHeight = 7.2
    else
        print("Unequipped")
    end
end)

clear holly
#

does it work

fading marsh
#

yeah none of my else statements are firing

clear holly
#

does ur tool have a handle?

fading marsh
#

Yes

clear holly
# fading marsh Yes

can u run the game, find ur character's humanoid, click on the humanoid, and equip and unequip the tool?

fading marsh
#

Its added and removed from the humanoid everytime i equip and unequip

clear holly
fading marsh
clear holly
fading marsh
#

Serverscript

clear holly
#

i dont see why it's not working for you as it works for me

#

can isee the handle part

#

@fading marsh

fading marsh
clear holly
#

can you use this?

local tool = script.Parent

local humanoid

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

    if humanoid then
        humanoid.JumpHeight = 15
    end
end)

tool.Unequipped:Connect(function()
    if humanoid then
        humanoid.JumpHeight = 7.2
    end
end)
fading marsh
#

Ok

#

oh wait that code works

#

what did you do?

clear holly
#

you cant find the humanoid at the unequipped function

#

so i made a nil humanoid variable outside the functions

#

and then i did humanoid = tool.Parent:FindFirstChild("Humanoid") inside the .equipped function, turning the variable as a humanoid variable

fading marsh
clear holly
fading marsh
clear holly
#

btw i was wondering if you use the console output window on roblox studio

#

cause if u dont use it

#

it'll help u fix most of ur errors

#

the reason it didn't throw an error is cause u added an if check to see if the humanoid exists or not

clear holly
subtle mapleBOT
#

studio** You are now Level 3! **studio

fading marsh
#

thanks so much for the help man

clear holly
#

np

fading marsh
#

OH WAIT I SEE WHAT I DID WRONG

#

THANK YOU SO MUCH

clear holly
#

no problem

fading marsh
#

i referenced the humanoid as a parent when the tool wasnt even in it

#

dang

#

i would've never know

clear holly
#

well now you know