Should I put animations in tool or in ReplicatedStorage?
local Players = game:GetService('Players')
local localPlayer = Players.LocalPlayer
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local animator = character:WaitForChild('Humanoid'):WaitForChild('Animator')
local myTool = script.Parent
local animations = myTool:WaitForChild('Animations')
local myAnimation = animator:LoadAnimation(animations:WaitForChild('MyAnimation'))
local debounce = false
myTool.Activated:Connect(function()
if not debounce then
debounce = true
myAnimation:Play()
debounce = false
end
end)
------------------------------------------------------------------------------------------------------------------------------------------
local Players = game:GetService('Players')
local ReplicatedFirst = game:GetService('ReplicatedFirst')
local localPlayer = Players.LocalPlayer
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local animator = character:WaitForChild('Humanoid'):WaitForChild('Animator')
local myTool = script.Parent
local myAnimation = animator:LoadAnimation(ReplicatedFirst.Animations.MyAnimation)
local debounce = false
myTool.Activated:Connect(function()
if not debounce then
debounce = true
animationTrack:Play()
debounce = false
end
end)