You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want the animation to fire -
What is the issue? Include screenshots / videos if possible!
When I mouse click the animation does not fire but when I unequip the tool and mouse button click at the same time it fires…
-- local drinkcoffeeevent = game:GetService("ReplicatedStorage").events.drinkcoffee
local player = game:GetService("Players").LocalPlayer
local debounce = false
script.Parent.Parent.Equipped:Connect(function(mouse)
mouse.Button1Down:Connect(function()
if debounce == false then
debounce = true
print("the pressed fired")
-- drinkcoffeeevent:FireServer(player) <-- ignore this
local animations = player.Character:FindFirstChild("Humanoid").Animation
local new = player.Character:FindFirstChild("Humanoid").Animator:LoadAnimation(animations)
new:Play()
task.wait(1.5)
debounce = false
end
end)
end)
script.Parent.Parent.Unequipped:Connect(function()
debounce = false
end)
-----------------------------------------------------------------------------------------------------------------------
server script for giving the animations to humanoid
player.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local animation = Instance.new('Animation')
animation.AnimationId = "rbxassetid://12770956899"
local animator = Instance.new("Animator"):Clone()
animator.Parent = char:WaitForChild("Humanoid")
local new = animation:Clone()
new.Parent = char:WaitForChild("Humanoid")
end)
end)