A issue with stopping the animation

This post is the same as my last post, but its just with animations. The animation does properly work when doing machines, playing and stopping. But cliently, the animation does not stop and they keep doing the animation while walking/idleing and other stuff.
image

Forgot to send the scripts, oops.

Machine hold/let go script:

local CurrentTrack = {}
local pos = script.Parent.Parent.Parent.liquid.Position
local texture = script.Parent.Parent.Parent.zzz.Decal
script.Parent.Parent.Parent.thing.Transparency=0
script.Parent.Parent.Parent.thing.SurfaceGui.Enabled=true
local originaloritentration = Vector3.new(script.Parent.Parent.Parent.Geat.Orientation)
script.Parent.Enabled=false
texture.Texture = "http://www.roblox.com/asset/?id=105974808672761"
task.wait(0.35)
texture.Texture = "http://www.roblox.com/asset/?id=73612493336938"
task.wait(0.35)
texture.Texture = "http://www.roblox.com/asset/?id=135225986072289"
task.wait(0.35)
texture.Texture = "http://www.roblox.com/asset/?id=74160352852888"
task.wait(0.35)
texture.Texture = "http://www.roblox.com/asset/?id=135718144615467"
task.wait(1)
texture.Texture = "http://www.roblox.com/asset/?id=102965939904260"
task.wait(0.35)
texture.Texture = "http://www.roblox.com/asset/?id=115693782887009"
task.wait(0.35)
texture.Texture = "http://www.roblox.com/asset/?id=105974808672761"
task.wait(0.35)
texture.Texture = "http://www.roblox.com/asset/?id=73612493336938"
task.wait(0.35)
texture.Texture = "http://www.roblox.com/asset/?id=135225986072289"
task.wait(0.35)
texture.Texture = "http://www.roblox.com/asset/?id=74160352852888"
task.wait(0.35)
texture.Texture = "http://www.roblox.com/asset/?id=135718144615467"
task.wait(1)
texture.Texture = "http://www.roblox.com/asset/?id=102965939904260"
task.wait(0.35)
texture.Texture = "http://www.roblox.com/asset/?id=115693782887009"
task.wait(0.35)
texture.Texture = "http://www.roblox.com/asset/?id=126640162888980"
task.wait(0.5)
texture.Texture = "http://www.roblox.com/asset/?id=136654664363162"
task.wait(0.5)
texture.Texture = "http://www.roblox.com/asset/?id=126640162888980"
task.wait(0.5)
texture.Texture = "http://www.roblox.com/asset/?id=136654664363162"
task.wait(0.5)
texture.Texture = "http://www.roblox.com/asset/?id=76590158967863"
task.wait(0.5)
texture.Texture = "http://www.roblox.com/asset/?id=84082083431768"
task.wait(0.5)
script.Parent.Parent.Parent.Green.Decal.Texture = "http://www.roblox.com/asset/?id=77551215367536"
task.wait(0.5)
script.Parent.Parent.Parent.Green.Decal.Texture = "http://www.roblox.com/asset/?id=77551215367536"
task.wait(0.5)
script.Parent.Parent.Parent.zzz.PointLight.Enabled=true
script.Parent.Parent.Parent.thing.Transparency=1
script.Parent.Parent.Parent.thing.SurfaceGui.Enabled=false
script.Parent.Parent.Parent.Green.Decal.Texture = "http://www.roblox.com/asset/?id=80683068900382"
script.Parent.Parent.Parent.zzz.Decal.Nowork.Enabled=true
script.Parent.Parent.Parent.zzz.Decal.Transparency=0
script.Parent.Enabled=true

script.Parent.PromptButtonHoldBegan:Connect(function(Player)
	if script.Parent.User.Value == "No One" then
		if Player.Character:FindFirstChild("Plr") then
			Player.Character.HumanoidRootPart.CFrame = workspace.TP.CFrame
			local gettext = game.ReplicatedStorage.text:Clone()
			gettext.TextColor3 = Color3.new(1, 0.52549, 0.52549)
			gettext.Text = "You cant fill up a machine as a player/unhinged!"
			Player.PlayerGui.Error:Play()
			gettext.LocalScript.Enabled=true
			gettext.Parent = Player.PlayerGui.textz.Frame
		else
			if Player.Character.Extraction.Value == 1 then
				script.Parent.Parent.Parent.Seconds.Value = 40
				script.Parent.HoldDuration = 40
			elseif Player.Character.Extraction.Value == 2 then
				script.Parent.Parent.Parent.Seconds.Value = 35
				script.Parent.HoldDuration = 35
			elseif Player.Character.Extraction.Value == 3 then
				script.Parent.Parent.Parent.Seconds.Value = 30
				script.Parent.HoldDuration = 30
			elseif Player.Character.Extraction.Value == 4 then
				script.Parent.Parent.Parent.Seconds.Value = 25
				script.Parent.HoldDuration = 25
			elseif Player.Character.Extraction.Value == 5 then
				script.Parent.Parent.Parent.Seconds.Value = 20
				script.Parent.HoldDuration = 20
			end
			if Player.Character.hasguiblocking.Value == true then
				Player.Character.HumanoidRootPart.CFrame = workspace.TP.CFrame
				local gettext = game.ReplicatedStorage.text:Clone()
				gettext.TextColor3 = Color3.new(1, 0.52549, 0.52549)
				gettext.Text = "You cant fill up a machine with gui blocking your screen!"
				Player.PlayerGui.Error:Play()
				gettext.LocalScript.Enabled=true
				gettext.Parent = Player.PlayerGui.textz.Frame
			elseif Player.Character.hasguiblocking.Value == false then
				Player.PlayerGui.ScreenGui.Frame.TextButton.Interactable=false
				Player.PlayerGui.ScreenGui.Frame.TextButton2.Interactable=false
			script.Parent.Parent.Parent.zzz.Decal.Nowork.Disabled=true
			script.Parent.Parent.Parent.zzz.Decal.workng.Disabled=false
				Player.PlayerGui.ScreenGui.Frame.Sprint2.Visible = false
			script.Parent.User.Value = Player.Character.Name
			Player.PlayerGui.PLRCHECK.Disabled=true
			game.ReplicatedStorage.turnoffemoes:FireClient(Player)
				Player.PlayerGui.ScreenGui.TextButton5.Interactable=false
	script.Parent.Parent.Parent.Tube.Script.Enabled=true
	local Character = Player.Character
	local orentation = script.Parent.Parent.Parent.Orientation
	script.Parent.Parent.Parent.liquid.shake.Enabled=true
	local Humanoid = Character:WaitForChild("Humanoid")
	Character.HumanoidRootPart.CFrame = CFrame.new(orentation)
	Character.HumanoidRootPart.CFrame = script.Parent.Parent.Parent.CFrame
				script.Parent.Parent.Parent.Tube.Attachment.Beam.Enabled=true
				script.Parent.Parent.Parent.liquid.SpinScript.Enabled=false
				script.Parent.Parent.Parent.Tube.Attachment2.Beam2.Enabled=true
				local TweenService = game:GetService("TweenService")
				local PartA = script.Parent.Parent.Parent.Tube.Part
				local PartB = script.Parent.Parent.Parent.Tube.daa
				-- Define the tween information
				local tweenInfo = TweenInfo.new(
					0.2, -- Time (in seconds) for the tween to complete
					Enum.EasingStyle.Quad, -- Easing style
					Enum.EasingDirection.InOut -- Easing direction
				)

				-- Define the goal properties for the tween
				local goal = { Position = PartB.Position }

				-- Create the tween
				local tween22233 = TweenService:Create(PartA, tweenInfo, goal)

				-- Play the tween
				tween22233:Play()

	Character.HumanoidRootPart.Anchored = true
	local Animator = Humanoid and Humanoid:WaitForChild("Animator")
	local Animation = Instance.new("Animation")
		if Character:FindFirstChild("Skin").Value == "Shorky" then
					Animation.AnimationId = "rbxassetid://77840958750888" --Your animation id
		elseif Character:FindFirstChild("Skin").Value  == "Ticker" then
					Animation.AnimationId = "rbxassetid://89956104970102" --Your animation id
		elseif Character:FindFirstChild("Skin").Value == "Sendler" then
					Animation.AnimationId = "rbxassetid://127941787809957" --Your animation id
		elseif Character:FindFirstChild("Skin").Value == "Sandy" then
					Animation.AnimationId = "rbxassetid://77078688056630" --Your animation id
		elseif Character:FindFirstChild("Skin").Value == "Felix" then
					Animation.AnimationId = "rbxassetid://89766704275397" --Your animation id	
		elseif Character:FindFirstChild("Skin").Value == "Sadie" then
					Animation.AnimationId = "rbxassetid://92797215349525" --Your animation id	
		elseif Character:FindFirstChild("Skin").Value == "Rinny" then
					Animation.AnimationId = "rbxassetid://120636730220476" --Your animation id	
		elseif Character:FindFirstChild("Skin").Value == "Huji" then
					Animation.AnimationId = "rbxassetid://127667196575169" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Foster" then

					Animation.AnimationId = "rbxassetid://136725466378693" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Cecelia" then

					Animation.AnimationId = "rbxassetid://139495073765679" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Keyla" then
					Animation.AnimationId = "rbxassetid://92695899289429" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Melody" then
					Animation.AnimationId = "rbxassetid://85403208190332" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Gloomy" then
					Animation.AnimationId = "rbxassetid://90317288184492" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Sol" then
					Animation.AnimationId = "rbxassetid://115930253581935" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Dicey" then
					Animation.AnimationId = "rbxassetid://134235966411717" --Your animation id	
				
				
					
					
		end
	CurrentTrack[Player.Name] = Animator:LoadAnimation(Animation)
	CurrentTrack[Player.Name].Looped = true
	CurrentTrack[Player.Name]:Play()
	script.Parent.Parent.Parent.liquid.whi.Enabled=true
	script.Parent.Parent.Parent.Geat.Script.Enabled=true
	script.Parent.Parent.Parent.Geat.turn:Play()
	script.Parent.Parent.Parent.Geat.Sound:Play()
	end
		end
	else
		Player.Character.HumanoidRootPart.CFrame = workspace.TP.CFrame
		local gettext = game.ReplicatedStorage.text:Clone()
		gettext.TextColor3 = Color3.new(1, 0.52549, 0.52549)
		gettext.Text = "You cant fill up this machine since " .. script.Parent.User.Value .. " is already using it!"
		Player.PlayerGui.Error:Play()
		gettext.LocalScript.Enabled=true
		gettext.Parent = Player.PlayerGui.textz.Frame
	end
end)

function stop(Player)
	if Player.Character.Name == script.Parent.User.Value then
		if Player.Character:FindFirstChild("Plr") then
			
		else
			if Player.Character.hasguiblocking.Value == true then
				Player.Character.HumanoidRootPart.Cframe = workspace.TP.CFrame
				local gettext = game.ReplicatedStorage.text:Clone()
				gettext.TextColor3 = Color3.new(1, 0.52549, 0.52549)
				gettext.Text = "You cant fill up a machine with gui blocking your screen!"
				Player.PlayerGui.Error:Play()
				gettext.LocalScript.Enabled=true
				gettext.Parent = Player.PlayerGui.textz.Frame
			else
				script.Parent.Parent.Parent.Seconds.Value = 20
				Player.PlayerGui.ScreenGui.Frame.Sprint2.Visible = true
				Player.PlayerGui.ScreenGui.Frame.TextButton.Interactable=true
				Player.PlayerGui.ScreenGui.Frame.TextButton2.Interactable=true
				script.Parent.Parent.Parent.zzz.Decal.Nowork.Disabled=false
				script.Parent.Parent.Parent.zzz.Decal.workng.Disabled=true
				script.Parent.Parent.Parent.Geat.Orientation = Vector3.new(0,90,0)
				game.ReplicatedStorage.turnonemotes:FireClient(Player)
				Player.PlayerGui.ScreenGui.TextButton5.Interactable = true
				Player.PlayerGui.PLRCHECK.Disabled=false
		script.Parent.Parent.Parent.Tube.Script.Enabled=false
		
		script.Parent.Enabled=false
		local Character = Player.Character
		local Humanoid = Character:WaitForChild("Humanoid")
		script.Parent.User.Value = "No One"
		Character.HumanoidRootPart.Anchored = false
		local Animator = Humanoid and Humanoid:WaitForChild("Animator")
		local Animation = Instance.new("Animation")
				if Character:FindFirstChild("Skin").Value == "Shorky" then
					Animation.AnimationId = "rbxassetid://77840958750888" --Your animation id
				elseif Character:FindFirstChild("Skin").Value  == "Ticker" then
					Animation.AnimationId = "rbxassetid://89956104970102" --Your animation id
				elseif Character:FindFirstChild("Skin").Value == "Sendler" then
					Animation.AnimationId = "rbxassetid://127941787809957" --Your animation id
				elseif Character:FindFirstChild("Skin").Value == "Sandy" then
					Animation.AnimationId = "rbxassetid://77078688056630" --Your animation id
				elseif Character:FindFirstChild("Skin").Value == "Felix" then
					Animation.AnimationId = "rbxassetid://89766704275397" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Sadie" then
					Animation.AnimationId = "rbxassetid://92797215349525" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Rinny" then
					Animation.AnimationId = "rbxassetid://120636730220476" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Huji" then
					Animation.AnimationId = "rbxassetid://127667196575169" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Foster" then

					Animation.AnimationId = "rbxassetid://136725466378693" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Cecelia" then

					Animation.AnimationId = "rbxassetid://139495073765679" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Keyla" then
					Animation.AnimationId = "rbxassetid://92695899289429" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Melody" then
					Animation.AnimationId = "rbxassetid://85403208190332" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Gloomy" then
					Animation.AnimationId = "rbxassetid://90317288184492" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Sol" then
					Animation.AnimationId = "rbxassetid://115930253581935" --Your animation id	
				elseif Character:FindFirstChild("Skin").Value == "Dicey" then
					Animation.AnimationId = "rbxassetid://134235966411717" --Your animation id	
					
				




				end
		CurrentTrack[Player.Name] = Animator:LoadAnimation(Animation)
		CurrentTrack[Player.Name].Looped = true
		CurrentTrack[Player.Name]:Play()
		CurrentTrack[Player.Name]:Stop()
		script.Parent.Parent.Parent.liquid.whi.Enabled=false
		script.Parent.Parent.Parent.liquid.SpinScript.Enabled=true
		script.Parent.Parent.Parent.Geat.Script.Enabled=false
				script.Parent.Parent.Parent.liquid.shake.Enabled=false
				
				local TweenService = game:GetService("TweenService")
				local PartA = script.Parent.Parent.Parent.Tube.Part
				local PartB = script.Parent.Parent.Parent.Tube.daa2
				-- Define the tween information
				local tweenInfo = TweenInfo.new(
					0.2, -- Time (in seconds) for the tween to complete
					Enum.EasingStyle.Quad, -- Easing style
					Enum.EasingDirection.InOut -- Easing direction
				)

				-- Define the goal properties for the tween
				local goal = { Position = PartB.Position }

				-- Create the tween
				local tween5555 = TweenService:Create(PartA, tweenInfo, goal)

				-- Play the tween
				tween5555:Play()
				task.wait(0.2)
				script.Parent.Parent.Parent.Tube.Attachment.Beam.Enabled=false
				script.Parent.Parent.Parent.Tube.Attachment2.Beam2.Enabled=false
		
		script.Parent.Parent.Parent.Geat.turn:Stop()
		script.Parent.Parent.Parent.Geat.Sound:Stop()
				local TweenService = game:GetService("TweenService")
				local part = script.Parent.Parent.Parent.liquid

				local tweenInfo = TweenInfo.new(
					5, -- Time (in seconds)
					Enum.EasingStyle.Linear, -- EasingStyle
					Enum.EasingDirection.Out, -- EasingDirection
					0, -- RepeatCount (0 = no repeat)
					false, -- Reverses
					0 -- DelayTime
				)

				local tweenGoal = {}
				tweenGoal.Color = Color3.new(1, 1, 1) -- White color

				local tween222 = TweenService:Create(part, tweenInfo, tweenGoal)

				tween222:Play()

				local part = script.Parent
				local percentValue = script.Parent.Parent.Parent.Percent

				if percentValue then
					local initialValue = percentValue.Value -- Get the current percent value
					local duration = 5 -- Time in seconds to drain to 0
					local startTime = tick()

					while tick() - startTime < duration do
						local elapsed = tick() - startTime
						local percentage = initialValue - (elapsed / duration) * initialValue
						percentValue.Value = math.clamp(percentage, 0, 100)
						task.wait(0.1) -- Adjust the wait time as needed for smoothness
					end

					percentValue.Value = 0 -- Ensure it ends at 0%
				end


		task.wait(.5)
		script.Parent.Enabled=true
		end
		
	end
	else
		
    end
end

script.Parent.PromptButtonHoldEnded:Connect(function(Player)
	if Player.Name == script.Parent.User.Value then
		stop(Player)
	end
end)

Machine finish script:

script.Parent.TriggerEnded:Connect(function(plr)
	script.Parent.Parent.Parent.zzz.Decal.workng.Disabled=true
	script.Parent.Parent.Parent.zzz.PointLight.Color = Color3.fromRGB(176, 255, 175)
	script.Parent.Parent.Parent.Green.Decal.Texture = "http://www.roblox.com/asset/?id=77551215367536"
	script.Parent.Parent.Parent.zzz.Decal.transition.Disabled=false
	script.Parent.Enabled=false
	local clone = script.Parent.Parent.Parent.liquid:Clone()
	local multiplier = 1
	if plr.Ability.Value == "TSG" then
		multiplier += 1
	elseif plr.Ability.Value == "OTA" then
		multiplier = 0.5
	elseif plr.Ability.Value == "DLD" then
		local maths = math.random(1,4)
		plr.PlayerGui.diceroll:Play()
		if maths == 1 then
			multiplier = 0.5
			local gettext = game.ReplicatedStorage.text:Clone()
			local Player = plr
			gettext.TextColor3 = Color3.new(1, 1, 1)
			gettext.Text = "Dice rolled... Multiplier: 0.5X"
			Player.PlayerGui.Error:Play()
			gettext.LocalScript.Enabled=true
			gettext.Parent = Player.PlayerGui.textz.Frame
		elseif maths == 2 then
			local gettext = game.ReplicatedStorage.text:Clone()
			local Player = plr
			gettext.TextColor3 = Color3.new(1, 1, 1)
			gettext.Text = "Dice rolled... Multiplier: 1X"
			Player.PlayerGui.Error:Play()
			gettext.LocalScript.Enabled=true
			gettext.Parent = Player.PlayerGui.textz.Frame
			multiplier = 1
		elseif maths == 3 then
			local gettext = game.ReplicatedStorage.text:Clone()
			local Player = plr
			gettext.TextColor3 = Color3.new(1, 1, 1)
			gettext.Text = "Dice rolled... Multiplier: 1.5X"
			Player.PlayerGui.Error:Play()
			gettext.LocalScript.Enabled=true
			gettext.Parent = Player.PlayerGui.textz.Frame
			multiplier = 1.5
		elseif maths == 4 then
			local gettext = game.ReplicatedStorage.text:Clone()
			local Player = plr
			gettext.TextColor3 = Color3.new(1, 1, 1)
			gettext.Text = "Dice rolled... Multiplier: 2X"
			Player.PlayerGui.Error:Play()
			gettext.LocalScript.Enabled=true
			gettext.Parent = Player.PlayerGui.textz.Frame
			multiplier = 2
		end
	else
		
	end
	if plr.Ability.Value == "FAF" then
		local basic = 1
		if plr.Machines.Value > 44 then
			basic += 0.1
		end
		if plr.Machines.Value > 89 then
			basic += 0.1
		end
		if plr.Machines.Value > 134 then
			basic += 0.1
		end
		if plr.Machines.Value > 179 then
			basic += 0.1
		end
		if plr.Machines.Value > 224 then
			basic += 0.1
		end
		if plr.Machines.Value > 269 then
			basic += 0.1
		end
		if plr.Machines.Value > 314 then
			basic += 0.1
		end
		if plr.Machines.Value > 359 then
			basic += 0.1
		end
		if plr.Machines.Value > 404 then
			basic += 0.1
		end
		if plr.Machines.Value > 449 then
			basic += 0.1
		end
		if plr.Machines.Value > 539 then
			basic += 0.1
		end
		if plr.Machines.Value > 584 then
			basic += 0.1
		end
		if plr.Machines.Value > 629 then
			basic += 0.1
		end
		if plr.Machines.Value > 674 then
			basic += 0.1
		end
		if plr.Machines.Value > 719 then
			basic += 0.1
		end
		if plr.Machines.Value > 764 then
			basic += 0.1
		end
		if plr.Machines.Value > 809 then
			basic += 0.1
		end
		if plr.Machines.Value > 854 then
			basic += 0.1
		end
		if plr.Machines.Value > 899 then
			basic += 0.1
		end
		if plr.Machines.Value > 484 then
			basic += 0.1
		end
		multiplier = basic
		local gettext = game.ReplicatedStorage.text:Clone()
		local Player = plr
		gettext.TextColor3 = Color3.new(0.756863, 0.756863, 0.756863)
		plr.PlayerGui.fam:Play()
		task.wait(0.2)
		if basic == 3 then
			gettext.Text = "Current multiplier: " .. basic .. "X (Max!)"
		else
			gettext.Text = "Current multiplier: " .. basic .. "X"
		end
		Player.PlayerGui.Error:Play()
		gettext.LocalScript.Enabled=true
		gettext.Parent = Player.PlayerGui.textz.Frame
		multiplier = 2
	end
	plr:FindFirstChild("Oil").Value = plr:FindFirstChild("Oil").Value + 10 * multiplier
	plr:FindFirstChild("Machines").Value = plr:FindFirstChild("Machines").Value + 1
	clone.Parent = script.Parent.Parent.Parent
	clone.Name = "Liquid2"
	script.Parent.Parent.Parent.liquid.Transparency=1
	script.Parent.Parent.Parent.Geat.Sound:Stop()
	script.Parent.Enabled=false
	script.Parent.User.Value = "No One"
	plr.PlayerGui.ScreenGui.Frame.TextButton.Visible=true
plr.PlayerGui.ScreenGui.Frame.TextButton2.Visible=true
	script.Parent.Parent.Parent.Geat.d:Play()
	local chr = plr.Character
	script.Parent.Hold:Destroy()
	script.Parent.Parent.Parent.Green.BrickColor = BrickColor.new("Artichoke")
	script.Parent.Parent.Parent.Tube.daa.ParticleEmitter.Enabled=true
	plr.Character.Head.Attachment.Script.Enabled=true
	task.wait(0.2)
	script.Parent.Parent.reset.Script.Enabled=true
	script.Parent.Parent.Parent.Tube.Attachment.Beam.Enabled=false
	script.Parent.Parent.Parent.Tube.Attachment2.Beam2.Enabled=false
end)