How can I add a teleporter to this part?

Whenever I add a teleport script to the moving spotlight (as shown in the video below), which canCollide is set as false, it just doesn’t work. What script can I use for it to teleport the player to a certain position when the yellow part attatched to the NPC is touched?

Here’s the video:

Could you send the script over here?

Well, I just used a free model script, but here it is:


local Teleport = “Lentilkac58-Easy-Teleport-2” --Put the name of the Part between the ""s.

function Touch(hit) --Indicates that the Part has been Touched.

if script.Parent.Locked == false and script.Parent.Parent:findFirstChild(Teleport).Locked == false then script.Parent.Locked = true script.Parent.Parent:findFirstChild(Teleport).Locked = true --Checks Debounce.

local Pos = script.Parent.Parent:findFirstChild(Teleport) --Gets the Part to teleport to.

hit.Parent:moveTo(Pos.Position) wait(1) script.Parent.Locked = false script.Parent.Parent:findFirstChild(Teleport).Locked = false end end --Takes you there and Ends the Function.

script.Parent.Touched:connect(Touch) --Listens out for Touchers.


I tried many different scripts and it still won’t work.

Are there any errors that pop up in the output?
Have you checked that the Teleport name is the same as the one you want to teleport to?
Do they have the same parent?

No, there aren’t.

Yes to both of them.

I have a better and less confusing one for you:

local part = workspace.MyPart -- Change this to your part

script.Parent.Touched:Connect(function(hit)
	
	local human = hit.Parent:FindFirstChild("Humanoid")
	
	if (human~=nil) then
		
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		
		player.Character.HumanoidRootPart.CFrame = CFrame.new(part.Position)
		
	end
	
end)
3 Likes

Thank you so much!! It worked!

1 Like