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

Sorry if I already said this but, How do you teleport?

What I tried...

Player = game.Players.LocalPlayer if script.Parent.Parent.Name ~= "GO!" or "Waiting.." then script.Disabled = true else script.Disabled = false end

function onTouch() Player.Character.Torso.CFrame = CFrame.new(-29.799, 4, 109.567) Player.Character.Humanoid.WalkSpeed = 0 wait(10) Player.Character.Humanoid.WalkSpeed = 16 end

script.Parent.Touched:connect(onTouch)

I did this in a Local Script

1 comment

0

Your code would be much more readable if you only had one statement per line, and also remember to use the Lua code formatting to make it more readable on here!

6 answers

Are you getting any syntax errors? Check the output. Otherwise try Player.Character:MoveTo(Vector3.new(-30, 4, 110);

2 comments

0

Has a red line under it when I did yours.

0

He forgot a )

Wait sorry...

Player = game.Players.LocalPlayer
if script.Parent.Parent.Name ~= "GO!" or "Waiting.." then
	script.Disabled = true
else
	script.Disabled = false
end

function onTouch()
	Player.Character.Torso.CFrame = CFrame.new(-29.799, 4, 109.567)
	Player.Character.Humanoid.WalkSpeed = 0
	wait(10)
	Player.Character.Humanoid.WalkSpeed = 16
end

script.Parent.Touched:connect(onTouch)

Hope this made it more viewable.

http://wiki.roblox.com/index.php?title=Teleport_(Method) http://wiki.roblox.com/index.php?title=Teleportation

Or try this.

player = game.Players.Player --you might want to change this... target = Vector3.new(20, 10, 20) --...and this

function fadeTo(a, b, c) for transparency = a, b, c do --go from a to b, counting by c

	for _, part in pairs(player.Character:GetChildren()) do
	--for each of the objects in the character,

		if part:IsA("BasePart") then
		--check if it's a part, and if so

			part.Transparency = transparency
			--set its transparency
		end
	end
	wait(0.1)
end

end

fadeTo(0, 1, 0.1) --fade out, player.Character.Torso.CFrame = target --teleport the player fadeTo(1, 0, -0.1) --fade back in

Do this in a regular script, also put the script in the part.

function Touch()
	p = script.Parent:FindFirstChild()
	if(p.Humanoid ~= nil) then
		p.Torso.CFrame = CFrame.new(0,0,0) --Change 0,0,0 to the position you want
end

script.Parent.Touched:connect(Touch)

Try this. (I'm assuming you want a part where you get teleported on touch)

function onTouch(h)
	if (script.Parent.Parent.Name == "GO!" or script.Parent.Parent.Name == "Waiting..") then
		local Player = game.Players:GetPlayerFromCharacter(h.Parent)
		
		if Player then
			Player.Character.Torso.CFrame = CFrame.new(-29.799, 4, 109.567)
			Player.Character.Humanoid.WalkSpeed = 0
			wait(10)
			Player.Character.Humanoid.WalkSpeed = 16
		end
	end
end

script.Parent.Touched:connect(onTouch)

You can do this,

Workspace.PLAYER:MoveTo(Vector3.new(0, 0, 0))

and then replace the coordinates to what ever you like.

But, you can also teleport your character to a specific part.

Workspace.PLAYER:MoveTo(Workspace.Part.Position)

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