How do i add a timer to a part?

so i have a part, an i would like to add a timer to it couting from 10, but the timer goes to 10 as long as the owner is touching it, how can i do that?


script.Parent.Touched:Connect(function(plr)
	if game.Players:GetPlayerFromCharacter(plr.Parent) then
		local owner = game.Players[script.Parent.Plr.Value]
		if owner.Antipush.Value == false then script.Parent.Anchored = false return end
		if  plr.Parent.Name == script.Parent.Plr.Value and owner.Antipush.Value == true then
			script.Parent.Anchored = false
			print("owner")
		elseif plr.Parent.Name ~= script.Parent.Plr.Value and owner.Antipush.Value == true then
			script.Parent.Anchored = true
			print("notowner")

		end
	end
end)
1 Like