I want this animation to play only when the tool is equipped. Currently it plays when ever you just press "y". How do I do this?
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Humanoid = Character:WaitForChild("Humanoid")
local tool = script.Parent
local Mouse = Player:GetMouse()
local kicking = Instance.new("Animation", Humanoid)
kicking.AnimationId = "http://www.roblox.com/item.aspx?id=273619670"
local function KeyDown(key)
key = key:lower()
if key == 'y' then
local animTrack = Humanoid:LoadAnimation(kicking)
animTrack:Play()
end
end
Mouse.KeyDown:connect(KeyDown)

1 comment
Can you show me an example?