Teleportation help script

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.

2 Likes

hi,

inside of the CFrame.new(...)

use,

CFrame.new(Vector3.new(...))
1 Like

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)

2 Likes

add another “)” to the "CFrame.new(Vector3.new(…)

2 Likes

it doesn’t work at all. same error which i started with

2 Likes
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)

this will probably work.

2 Likes

but if the player steps off the part, the player still gets teleported

2 Likes

it has the same error. I do not understand why

1 Like

here new one

local Touched = false
script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		Touched = true
		task.wait(2)
		hit.Parent.HumanoidRootPart.CFrame = CFrame.new(46, 60.25, -110.669)
		Touched = false
	end
end)
1 Like

the teleporter still sends you to the other part even if you step off.

Alright so, you re trying to add a delay.

Here you go.

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)
1 Like

Can u explain what u really want

It has the same error. if you step off, it still teleports you

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.

Try this,

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)

it has the same error, it still doesn’t work as intended.

New One

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)

Ive already responded on ur old page

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)

plus i found a lot of unicode

It has the same error I started off with.(“Humanoid”) and not Touched then
touched