Problem With Tool (If i click more time Animation start again and again)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? So its need work like “1 usemouse 1 time and then animation work, but if animation work the usemouse = false but if animation:Stop UseMouse = true”
    just like this
    ( I just dont have anyidea how its Edit in script)
If Animation:Play() == true then
Mouse.Button1Down =  false 
 if Animation:Stop()  == false then
 Mouse.Button1Down =  True
  1. What is the issue?

hare problem – https://youtu.be/vB5iqN7SpAM

script

local Dropper = true
Cup.Equipped:Connect(function(Mouse)
	local Animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Drink_Animation)
	Mouse.Button1Down:Connect(function()
		Animation:Play()
		print("Am win")
		
		Cup.Unequipped:Connect(function()
			Animation:Stop()
			
		end)
	end)
end)
  1. What solutions have you tried so far? I try see in Youtobe "Problem with tools "
    like this but its dosen’t work, (if you help me whare thx)).
1 Like

Add Something Like A Debounce Or A Cooldown Type of Thing So You Can’t Spam It A Lot…

1 Like

He also needs to add .Stopped to make the script more efficient

1 Like

put this SERVER script inside the Cup tool

local debounce = false --to prevent clicking
local Cup = script.Parent

Cup.Activated:Connect(function() --when clicked, must be in a character
    if debounce then return end --dont activate if debounce is true
    debounce = true --make sure it cant be activated
    local animation = Cup.Drink_Animation
    local track = Cup.Parent.Humanoid.Animator:LoadAnimation(animation) --load the animation
    track.Looped = false --make sure it isn't looped
    track:Play() --play the animation
    track.Stopped:Connect(function() --when animation is finished
        debounce = false --release the debounce
    end)
end)
2 Likes

Thx for help (Whare thx) I hope I come across more people like this.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.