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

Using the teleport service?

Hello! I've inserted the following script in a part. It is a local script.

local TeleportService = game:GetService("TeleportService")
local Place = 4536115280

script.Parent.Touched:connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player then
		TeleportService:Teleport(Place, player)
	end
end

When colliding with the part, you aren't moved to the game you should to. Any help?

2 comments

0

Are you testing this in studio? I think you can't teleport in studio

0

I wasn't teting in studio.

1 answer

You can't use Localscript with touched. Instead put it in a ServerScript Your using GetPlayerFromCharacter() anyway instead of game.Players.LocalPlayer.Character. So that means this goes in a ServerScript. As well when you put it in a ServerScript you cannot teleport in studio!

1 comment

0

I changed it into a server script but anyways it stills not working.

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