Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you make a OnTouch Teleport script?

So I want to make a script so when a player touches a brick they get teleported to a certain place, I guess this would be using co-ordinates?

Please reply with a script.

3 answers

✓ Accepted answer

Here's the most basic one. You can modify it if you have to:

Script inside of a Part:

script.Parent.Touched:connect(function(h)
if game.Players:GetPlayerFromCharacter(h.Parent) then
h.Parent.Torso.CFrame = CFrame.new(0, 1000, 0)  -- Change 0, 1000, 0 to the vectors (co-ordinates) you want
end
end)
partA = game.Workspace.PartA

function onTouch(partA)
	t = partA.Parent:FindFIrstChild("Torso")
	t.CFrame = game.Workspace.PartB.CFrame
end

partA.Touched:connect(onTouch)

I'm sorry, Requests are not allowed here. Other than that.

part.Touched:connect(function(p)
	local plr=game.Players:getPlayerFromCharacter(p.Parent)
	if plr~=nil then
		pcall(function()
			plr.Character.Torso.CFrame=Vector3.new(0,0,0)
`		end)
	end 
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.