I am trying to make a script when you touch a part your HumanoidRootPart gets anchored
and a function is called to check whenever you jump and whenever you do jump your HumanoidRootPart gets unanchored this side of the script works pretty good but the problem is I don’t know how to stop the function I have tried return and break but both of these don’t seem to work
I will appreciate your knowledge on this
script.Parent.Touched:Connect(function(PartThatTouched) if PartThatTouched.Name == "HumanoidRootPart" then local plr = game.Players:FindFirstChild(PartThatTouched.Parent.Name) local char = plr.Character local rootpart = char.HumanoidRootPart local humanoid = char:FindFirstChild("Humanoid") rootpart.Anchored = true humanoid:GetPropertyChangedSignal("Jump"):connect(function() print("Player Has Jumped") rootpart.Anchored = false end) end end)
This video may explain more:
as you can tell the function is still repeating and this will cause problems with other scripts