Hello, I have this script that doesn’t work on PC or Mobile. In studio it works but, on the website, it won’t work.
Here’s the script
local plr = game:GetService("Players").LocalPlayer
local anims = {script.Parent:WaitForChild("Anim"), script.Parent:WaitForChild("Anim")}
--script.Parent:WaitForChild("Anim")
local loadedAnims = {}
local tool = script.Parent
local animator
local debounce = true
local del = 1 --The cooldown between each click
--Connections:
--Click animation:
tool.Activated:Connect(function()
if(debounce) then --Setting up the debounce (cooldown)
debounce = false
animator = plr.Character:WaitForChild("Humanoid"):WaitForChild("Animator") --Find the animator object
if(not loadedAnims[2]) then --If the animation didn't exist yet
loadedAnims[2] = animator:LoadAnimation(anims[2]) --Load it
end
loadedAnims[2]:Play() --Play it
wait(del) --Wait the cooldown
debounce = true
end
end)
tool.Unequipped:Connect(function()
if(loadedAnims[2]) then --If the click animation was loaded
loadedAnims[2]:Stop() --Stop it once the tool is unequipped
end
end)
It was made by “Lightning TNT” on YouTube.
But I modified it to fit my game.
Video 1 (In studio)
Video 2 (In game)