I was just wondering something, and since school now I cant test it, but basically.
Would this work for a murder knife?
local waittime = 3 local tool = script.Parent local mouse = game.Players.LocalPlayer:GetMouse() tool.Equipped:connect(function(key) if key == "f" then mouse.KeyUp:connect(function() wait(waittime) runanimation() -- this would be a runanim function, for like throwing? end end end
so really i dont know if this would work?
Well yes that would work if you have the tool and the stuff basically in the right place... Like if you have the BodyVelocity
or what you want in there yes that would work but you have some mistakes in there the key that the person would equip it with would not be on the keyboard rather he would equip it with a hot key like using 1 - 9 and 0 to equip the tool. So the key is not a good argument for the Equipped Event
rather use it with the KeyUp
. Something like this...
local player = game.Players.LocalPlayer local mouse = player:GetMouse() tool.Equipped:connect(function() mouse.KeyUp:connect(function(key) if key == 'f' then wait(3) runanimation() end end) end)
However this will just run the animation when people stop holding down the 'f' key on the keyboard.
I hope I helped you and thank you for reading this answer.
~~KingLoneCat
Just to clairfy, KeyDown and KeyUp are deprecated.
function key(User, gameProcessedEvent) if User.KeyCode == Enum.KeyCode.R then --YOUR CODE!!! end game:GetService("UserInputService").InputBegan:connect(key)
Rather, use UserInputService, as KeyDown does not work on some devices.