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

TeleportService works on main place and not in the other place?

Asked by
Poine 30
7 years ago

Touch brick that creates an apartment and then TPs you. This works.

game:GetService('TeleportService').CustomizedTeleportUI = true

ds = game:GetService("DataStoreService"):GetGlobalDataStore()

local handler = game:GetService("AssetService")
local db = false

script.Parent.Touched:connect(function(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if h  and db == false then db = true
local p = game.Players:FindFirstChild(h.Parent.Name)
local createPlace = handler:CreatePlaceAsync(game.Players:FindFirstChild(p.Name).Name.."'s Apartment",445919249)    
wait(1)
game:GetService('TeleportService'):Teleport(createPlace,p)  
db = false  
end 
end)

Clickable button in the Apartment place thats supposed to take you back to the main game.This doesnt work and gives a local error.


game:GetService('TeleportService').CustomizedTeleportUI = true script.Parent.MouseClick:connect(function(p) wait(2) game:GetService('TeleportService'):TeleportToPlaceInstance(372961598,1,p) wait(2) end)

Error I get from Local Output : Teleport exception : HTTP 400 (HTTP/1.1 Bad Request)

0
What line is it on? arrowman888 69 — 7y
0
None, the script is a server script, I get an error in my LOCAL output that says Bad Request. And using just :Teleport() makes the game freeze Poine 30 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

I use this code for my main games children, it should work. Simple and efficient! xd

port = game:service("TeleportService")
ID = -- Put the ID of the main place in here
function onClicked()
port:Teleport(ID)
end

script.Parent.MouseButton1Click:connect(onClicked)


Ad

Answer this question