So the idea here, is that I want players to be able to choose what key they want to bind to the text button, just by simply right clicking on it. (Image below)
That way, they could just right click on the text button, then any key they want on their keyboard, so that when they press the key, it will play the animation.
(The animations are multiple decal, sprite frames for the yellow character below, and not for the player’s avatar.)
I am unable to find help on that, so I am stuck on clicking text buttons to play an animation, which is rather slow and annoying.
Here’s the script.
-- player = script.Parent.Parent.Parent.Parent.Parent.Character
function One()
script.Parent.Text = "IDLE"
--CODE HERE-- (I deleted it so it's not too long, but when the deleted code is here, clicking on the text button containing this script makes the idle animation play. For the keybind thing I'm pretty sure I have to do something at the end of the script, starting at local O = true)
end
function Two()
script.Parent.Text = "IDLE"
--CODE HERE--
end
local O = true
function onClicked()
if O == true then
O = false
One()
elseif O == false then
O = true
Two()
end
end
script.Parent.MouseButton1Down:connect(onClicked)
As one can see with the picture above, there’s a few animations there, Idle-Up-Down-Left and Right, the other words with different colors are just the character’s second form.