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

Button2Down doesn't work?

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

1 comment

0

You must have changed more than just Button1Down to Button2Down, because that functionality isn't just broken.

1 answer

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)

1 comment

0

MouseButton2Down is for right-clicking a GUI element.

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