Hi, so I just got into scripting and I want to make it so that when I touch a part it gets un anchored and then when I get off it it goes into the same position and gets anchored again. I managed to somehow make this work but the only problem is that when I touch the part it moves it multiple times. I figured that the only way to fix it is by adding debounce. However I have no clue on how to add it. (sorry if the script is a little messy, im really new to scripting so i'm not sure on how to organize it)
Thanks in advance!
local function Func1()
Part = game.Workspace.Part
print("FUNCTION 1 FIRED")
print("I WAS STEPPED ON SMH")
game.Workspace.Part.Anchored = false
end
local function Func2()
print("FUNCTION 2 FIRED")
print("OK IM GOOD NOW")
game.Workspace.Part.Anchored = true
Part.Position = Part.Position + Vector3.new(10,4.5,0)
end
game.Workspace.Part.Touched:Connect(Func1)
game.Workspace.Part.TouchEnded:Connect(Func2)
MY SCRIPT

3 comments
Use the code block to put scripts in so it looks more understandable
oh alright sorry
done