Like this?
local p = game.Players.LocalPlayer
local character = p.Character or p.CharacterAdded:wait()
local h = character:WaitForChild("Humanoid")
local Tool = script.Parent
local Event = Tool:WaitForChild("Event")
local tracks = {}
Event.Event:connect(function(mode, ...)
if (mode == "RunAnimation") then
local animName = "InspectAnimation"
if (not tracks[animName]) then
tracks[animName] = h:LoadAnimation(assert(Tool:FindFirstChild(animName), "The Animation '" .. animName .. "' is not under the tool."))
end
tracks[animName]:Play()
end
end)
|