This is an in game script that runs an animation when the f key is down and stops when it is up.
player = game:GetService("Players").LocalPlayer
char = player.Character
mouse = player:GetMouse()
local hum = char:FindFirstChild("Humanoid")
local anim = Instance.new("Animation",char)
anim.AnimationId = "http://www.roblox.com/asset?id=149359445"
anim.Name = "Animation"
mouse.KeyDown:connect(function(key)
if key:lower() == "f" then
animation = hum:LoadAnimation(char.anim)
animation:Play()
end
end)
mouse.KeyUp:connect(function(key)
if key:lower() == "f" then
animation:Stop()
end
end)
