Script looping when put an wait()

i’m working on a game, and i need a script for execute an char and makes the animation.
but well, somehow the script loops when i put a wait().

there’s a way to solve that?

script.Parent.Touched:Connect(function(p)
	if p.Parent:WaitForChild("Tecnical").IsTransfurmed.Value == false then
		script.Parent.Latex:Play()
		for _, v in pairs(p.Parent:GetChildren()) do
			
			v.Parent:WaitForChild("Tecnical").IsTransfurmed.Value = true
			
			local animation = p.Parent.Humanoid:LoadAnimation(script.Animation)
			animation:Play()
			p.Parent.Humanoid.WalkSpeed = 0
			p.Parent.Humanoid.JumpPower = 0
			p.Parent.Humanoid.AutoRotate = false
			
			local Humanoid = p.Parent:WaitForChild("Humanoid")
			local Accessories = {}
			local Player = p.Parent:GetChildren()

			v.Parent:WaitForChild("Torso").Color = Color3.new(0,0,0)
			v.Parent.Head.Color = Color3.new(0,0,0)
			v.Parent["Left Arm"].Color = Color3.new(0,0,0)
			v.Parent["Left Leg"].Color = Color3.new(0,0,0)
			v.Parent["Right Arm"].Color = Color3.new(0,0,0)
			v.Parent["Right Leg"].Color = Color3.new(0,0,0)
			
			script.Parent.Latex:Play()
			for i=1, #Player do
				if (Player[i].ClassName == 'Pants') then 
					Player[i]:Remove()
				end

				if (Player[i].ClassName == 'Shirt') then 
					Player[i]:Remove()
				end

				if (Player[i].ClassName == 'Shirt Graphic') then 
					Player[i]:Remove()
				end

				if (Player[i].ClassName == 'CharacterMesh') then 
					Player[i]:Remove()
				end
				for _, Acessory in pairs(Humanoid:GetAccessories()) do
					Humanoid:RemoveAccessories()
				end
				local Hat = game.ReplicatedStorage.Furry.Puro.Puro:Clone()
				local Floof = game.ReplicatedStorage.Furry.Puro.Floof:Clone()
				local Ear = game.ReplicatedStorage.Furry.Puro.Ear:Clone()
				local Neck = game.ReplicatedStorage.Furry.Puro.Neck:Clone()
				local Tail = game.ReplicatedStorage.Furry.Puro.Tail:Clone()

				v.Parent.Humanoid:AddAccessory(Hat)
				v.Parent.Humanoid:AddAccessory(Floof)
				v.Parent.Humanoid:AddAccessory(Ear)
				v.Parent.Humanoid:AddAccessory(Neck)
				v.Parent.Humanoid:AddAccessory(Tail)
				
				wait(3.5)
				p.Parent.Humanoid.WalkSpeed = 16
				p.Parent.Humanoid.JumpPower = 50
				p.Parent.Humanoid.AutoRotate = true
			end
		end
	end
end)

thanks <3

1 Like

but when the player touch it, the IsTransfur value is activated.

as you can see, in the line 2 for 4 says:

maybe it can be wrong placement of the value = true?

if p.Parent:WaitForChild("Tecnical").IsTransfurmed.Value == false then
		script.Parent.Latex:Play()
		for _, v in pairs(p.Parent:GetChildren()) do
			
			v.Parent:WaitForChild("Tecnical").IsTransfurmed.Value = true