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

Need help with values [?]

Asked by 9 years ago

my rocket boot script used to work its just when I tried to make the function only work when jumping is true, It doesn't. Help?

script.Parent.Parent.Humanoid.Changed:connect(function(Change)
    if Change == 'Jump' and Change.Value == true then
    script.Parent.Fire.Transparency = 0
    wait(0.2)
    script.Parent.Fire.Transparency = 1
    end
end)

what am I doing wrong

1 answer

Log in to vote
0
Answered by 9 years ago

Try using this for line two:

if Change == 'Jump' and script.Parent.Parent.Humanoid.Jump == true then

This instead accesses the Humanoid and looks at the Jump property and checks if it is true. If that doesn't work, the issue could be that the script checks the value before the player even begins jumping (scripts run incredibly fast). To fix this, use this modification.

script.Parent.Parent.Humanoid.Changed:connect(function(Change)
    if Change == 'Jump then
    wait() 
    if script.Parent.Parent.Humanoid.Jump == true then
    script.Parent.Fire.Transparency = 0
    wait(0.2)
    script.Parent.Fire.Transparency = 1
    end
end
end)

Just by adding the wait() it gives the game enough time to register the jump and change the value in the humanoid before we check it.

Ad

Answer this question