How should i make when player touches part then timer starts only for same player that touches part, but when part reaches zero then teleport to location?
Add a script to the part you want players to touch to begin the timer. Then paste the following code into that script:
local Players = game:GetService("Players") local teleporter = script.Parent local debounced = {} teleporter.Touched:Connect(function(part) local player = Players:GetPlayerFromCharacter(part.Parent) if player and not debounced[player] then -- Prevent multiple timers from running for player debounced[player] = true -- Set the location to teleport to local target = Vector3.new(0,5,0) -- Set the timer duration local duration = 5 -- Run the timer on a new thread spawn(function() -- Run the timer local remaining = duration while remaining > 0 do remaining = remaining - wait() end -- Timer finished, so teleport player player.Character.HumanoidRootPart.CFrame = CFrame.new(target) -- Remove the player from the table debounced[player] = nil end) end end)
I have added comments to the code for you to walk through and understand. If something isn't clear, then let me know and I can explain.