Nothing happens when I touched the part

game.Workspace.CoolPart.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
    if not debounce then debounce = true
            if positionValue == 1 then
                positionValue = 2
                game.Workspace.CoolPart.Position = Vector3.new(-33, 9, 8.75) --everything from here up works
            elseif positionValue == 2 then--everything down here doesnt
                positionValue = 3
                game.Workspace.CoolPart.Position = Vector3.new(42.75, 9.25, 57.75)
            elseif positionValue == 3 then
                positionValue = 4
                game.Workspace.CoolPart.Position = Vector3.new(9.75, 12, 38.25
                )
            end
        end
        debounce = false
    end
end)

There are no errors in the output

1 Like

Also want to add that the script would only stop working when I added debounces.

1 Like

Is the CanTouch property of the part enabled?

Seems like you just forgot to add basic variable for debounce

game.Workspace.CoolPart.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		
		local debounce = false
		local positionValue = game.Workspace:WaitForChild("CoolPart"):WaitForChild("Position_Value").Value
		
		if not debounce then debounce = true
			if positionValue == 1 then
				positionValue = 2
				game.Workspace.CoolPart.Position = Vector3.new(-33, 9, 8.75) --everything from here up works
			elseif positionValue == 2 then--everything down here doesnt
				positionValue = 3
				game.Workspace.CoolPart.Position = Vector3.new(42.75, 9.25, 57.75)
			elseif positionValue == 3 then
				positionValue = 4
				game.Workspace.CoolPart.Position = Vector3.new(9.75, 12, 38.25
				)
			end
		end
		debounce = false
	end
end)