I have recently been making a game, were you need to click a button to make an animation play however, I am having big trouble with doing so that the animation only plays once. How would I fix it? I have tried to add a wait() function in the end, however it doesn´t help on anything, the animation will still play multiple times if the player clicks the button again.
local hum = game.Workspace.Dannebrog.HumanoidCharacter
local set = hum.Parent.Settings
local sp = set.Speed
local enabled = set.Enabled
local ClickDetector = game.Workspace.FlagSign.Sign.ClickDetector
local humanim = hum:LoadAnimation(hum.Parent.Settings.IdleAnimation)
ClickDetector.MouseClick:Connect(function()
humanim:Play()
humanim.Looped = false
humanim:AdjustSpeed(sp.Value)
end)
