local Touched = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) and not Touched then
touched = true
wait(2) – add a two-second delay
hit.Parent.HumanoidRootPart.CFrame = CFrame.new(46, 60.25, -110.669)
touched = false
end
end)
and not Touched then
touched = true all of this is underlined.
it shows more errors: local Touched = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) and not Touched then
touched = true
wait(2) – add a two-second delay
hit.Parent.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(46, 60.25, -110.669)
touched = false
end
end)
local Touched = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) and not Touched then
touched = true
wait(2) – add a two-second delay
hit.Parent:MoveTo(Vector3.new(46, 60.25, -110.669))
touched = false
end
end)
script.Parent.Touched:Connect(function(hit) -- Detect if the player is touching it
if hit.Parent:FindFirstChild("Humanoid") then -- if the "Hit" is the Humanoid
delay(2, function() -- Delay to check if the player is still touching it
hit.Parent:MoveTo(Vector3.new(46, 60.25, -110.669)) -- Change the CFrame of the Character
end)
end
end)
Example: You step on part. You must stay in the part for two seconds, once you have stayed there for two seconds you then get teleported to the new location.
script.Parent.Touched:Connect(function(hit) -- Detect if the player is touching it
if hit.Parent:FindFirstChild("Humanoid") then -- if the "Hit" is the Humanoid
delay(2, function() -- Delay to check if the player is still touching it
hit.Parent:MoveTo(Vector3.new(46, 60.25, -110.669)) -- Change the CFrame of the Character
end)
end
end)
if it is not working then try this one,
script.Parent.Touched:Connect(function(hit) -- Detect if the player is touching it
if hit.Parent:FindFirstChild("Humanoid") then -- if the "Hit" is the Humanoid
delay(2, function() -- Delay to check if the player is still touching it
if hit.Parent:FindFirstChild("Humanoid") then -- if the "Hit" is the Humanoid
hit.Parent:MoveTo(Vector3.new(46, 60.25, -110.669)) -- Change the CFrame of the Character
end
end)
end
end)
local Touched = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
Touched = true
if script.Parent.TouchEnded then
return Touched
end
task.wait(2)
hit.Parent.HumanoidRootPart.Position = Vector3.new(46, 60.25, -110.669)
Touched = false
end
end)
its better to add a teleport part (the destination part) instead of presetting a CFrame
create a part, and set it as the “DestinationPart”
local Touched = false
local destpart = workspace.nameofdestinationpart
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and not Touched then
touched = true
task.wait(2)
hit.Parent.HumanoidRootPart.CFrame = destpart.CFrame
touched = false
end
end)