elseif Greenify.Value >= 4 and debounce == false and debounce1 == false then debounce1 = true ChangeColors(plr, Color3.fromRGB(118, 168, 124)) print ("Works1") chr.Humanoid.WalkSpeed = 0 chr.Humanoid.JumpPower = 0 --Player can't move, going to play an animation here too later print ("Works2") --wait(1) --HERE IS THE PROBLEM local Tree = game.ReplicatedStorage:FindFirstChild("Tree"):Clone() local plrposition = chr:FindFirstChild("HumanoidRootPart").Position local treeposition = Tree.Trunk.Position local newV = Vector3.new(plrposition.X, plrposition.Y - 10, plrposition.Z) Tree.HumanoidRootPart.Position = newV Tree.Parent = game.Workspace local loadedanimation = game.Workspace:FindFirstChild(Tree.Name).Humanoid:LoadAnimation(Tree.Trunk.Animation) loadedanimation:Play() print "Works2.3" --loadedanimation.Stopped:wait() --HERE IS THE PROBLEM wait(0.71666666666666667407) --This too Tree.HumanoidRootPart.Position = Vector3.new(newV.X, newV.Y + 10, newV.Z) print "Works2.6" print ("Works3") chr.Humanoid.Health = 0 print ("Works4") Greenify.Value = 0 print ("Works5") debounce1 = false
This is all of the code that matters but the problem is that every wait that I try to put in never works. It goes on forever and the rest of the code doesn't run. I haven't heard of anybody who has had the same issue and I don't understand why it's doing this. This is a local script and this is inside of a function if that matters.