Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

After teleporting to a game, how to grab data and move position based on where you teleported from?

Asked by 4 years ago

So, like in RPG games, if you were to enter a house from it would put you at the beginning of the door. But, if you came in the back way, it would lead you in at the back door not the front door.

I would like this function, but with teleporting to another place, and grabbing the data of the teleport service, and you teleported from one part of the map, it would teleport you to the second place, but in a different location.

This is the first script to the first game. Basically if you click the part it teleports you to the game. script in clickdetector on part

local TeleportService = game:GetService("TeleportService")
local placeID_1 = 4505065903
local placeID_2 = 4483453486

script.Parent.MouseClick:Connect(function(player)


TeleportService:Teleport(placeID_1, player,"Why")

end)
script.Parent.MouseClick:Connect()

local script in Startergui

local Data = game:GetService("TeleportService"):GetLocalPlayerTeleportData()

print (Data)

if Data == true then
    wait(.1)
    game.Players.Parent:FindFirstChild("Humanoid")
    game.Players.Torso.CFrame = game.Workspace.Finish.CFrame + Vector3.new(-103.2, 108.7, -129.7)
end

This is the script to the second game. It is successful with printing "Why", but it doesn't move the character to a designated area...I really don't know how to go about this script, is there a better way to do this???

Answer this question