Sorry if the title sounds weird it's the 100 character limit This is apart of a script in a game I'm making, the original script takes a sword from a sheath that is attached to the player via welding and, it makes the sword weld to the player's hand whilst playing this animation but, that doesn't matter so I narrowed it down so u can focus on the only parts you need to focus on to answer this question for me.
This is the script, it's a simple script that plays an animation when a key is pressed but I can't figure out how to make it so if I clicked the key twice it would play a different animation in my case put the sword back in the sheath.
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Anim4 = Instance.new("Animation")
Anim4.AnimationId = "http://www.roblox.com/Asset?ID=02919926374"
local Anim4 = Humanoid:LoadAnimation(Anim4)
function onKeyDown(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.T then
print("T was pressed")
Anim4:Play()
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyDown)

8 comments
http://www.roblox.com/support
?
We are not going to hand a Script to you without evidence of an attempt or an issue regarding the attempt. Try first, or contact ROBLOX Support, as we are not them.
I'm not asking for a script
I'm asking how would I use something like if and then to make it so if I click T twice it would play another animation using the same function
Okay then, take this: Store last key, use a tick timestamp for .5 second combo window, compare 'LastKey' to the new Key. Run separate Code based on the recorded Input.
that is what I did for a double tap w to sprint
So store last key and if the last key was the same as the new key then make it run whatever in my case a new animation?