Hello, I am working on an old roblox simulator inside roblox but I am having a big issue. How would I make an Image Button bring me to a different game? I have tried more than 6 videos but none work. Yes, I have turned third party teleports on.
Try making an ImageButton and putting this Script(not a LocalScript) inside of the button:
local PlaceId = 123456789
script.Parent.MouseButton1Click:Connect(function()
local Player = script:FindFirstAncestorOfClass("Player")
game:GetService("TeleportService"):TeleportAsync(PlaceId, {Player})
end)
Hello!
the solution you provided is correct, but it can be simplified. Here’s a variant that i propose:
local Place = 123457 --replace with desired placeid
local Button = script.Parent.ImageButton --replace with button path
local TP = game:GetService("TeleportService")
Button.Activated:Connect(function()
TP:Teleport(Place) --when called, the "Teleport" function automatically teleports the local player
end)
Hope we helped you!
also quick note: server scripts do not work when parented in starter gui. Only local scripts do!
I guess you can teleport from the client, didn’t know that. But server scripts still work inside of a PlayerGui.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.