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

Button2Down doesn't work?

Asked by 9 years ago

I have a script, when you press Button1Down it plays the animation, that works, I copied that animation, and changed Button1Down to Button2Down, but the Button2Down in the second script doesn't work! Why not? Here is the script

script.Parent.Equipped:connect(function(mouse)
    mouse.Button2Down:connect(function()
    local animation = script.Stab
    local plyr = script.Parent.Parent.Name
    local char = workspace:FindFirstChild(plyr)
    local anim = char.Humanoid:LoadAnimation(animation)
    anim:Play()
    end)
end)

Please help!!! Thank you!!! P.S there is not ouput

0
You must have changed more than just Button1Down to Button2Down, because that functionality isn't just broken. 1waffle1 2908 — 9y

1 answer

Log in to vote
-1
Answered by 9 years ago
script.Parent.Equipped:connect(function(mouse)
    mouse.MouseButton2Down:connect(function() -- try using MouseButton
    local animation = script.Stab
    local plyr = script.Parent.Parent.Name
    local char = workspace:FindFirstChild(plyr)
    local anim = char.Humanoid:LoadAnimation(animation)
    anim:Play()
    end)
end)

0
MouseButton2Down is for right-clicking a GUI element. 1waffle1 2908 — 9y
Ad

Answer this question