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

Can someone help to me with this teleport GUI for my cafe game?

Hey! I asked a question about this teleport GUI, and someone gave me this script. And here is the GUI I made. https://www.roblox.com/library/5157648137/Teleport

local MessagingService = game:GetService("MessagingService")
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")

function GetServerData(UserId)
    local PlaceId
    local JobId
    PlayerFoundConnection = MessagingService:SubscribeAsync("PlayerFound"):Connect(function(GivenUserId, GivenPlaceId, GivenJobId)
        if GivenUserId == UserId then
            PlaceId = GivenPlaceId
            JobId = GivenJobId
            PlayerFoundConnection:Disconnect()
        end
    end)
    MessagingService:PublishAsync("GetPlayer", UserId)
    repeat wait() until not PlayerFoundConnection.Connected
    return PlaceId, JobId
end

function TeleportPlayer(Player, PlaceId, JobId)
    TeleportService:TeleportToPlaceInstance(PlaceId, JobId, Player)
end

MessagingService:SubscribeAsync("GetPlayer"):Connect(function(UserId)
    for _, Player in pairs(Players:GetPlayers()) do
        if Player.UserId == UserId then
            MessagingService:PublishAsync("PlayerFound", UserId, game.PlaceId, game.JobId)
        end
    end
end)

Could someone help me?

4 comments

0

I don't know that much but should FindFirstChild and Player.Parent=(something idk) be included?

0

What do you need help with? I'm confused.

0

You are not supposed to ask questions regarding free models.

0

It's a free model I made though.

1 answer

Pretty simple :)

Start with inserting a ScreenGUI in StarterGUI then put a TextButton in the ScreenGUI then put a LocalScript in the TextButton


wait(1)
player = game.Players.LocalPlayer
button = script.Parent
local debounce = false

function helpme()
 if not debounce then
  
 debounce = true
 LowerTorso = player.Character.LowerTorso
 LowerTorso.CFrame = game.Workspace.telepart.CFrame
 
 end
end
button.MouseButton1Click:connect(helpme)

while true do wait()
debounce = false
wait(7.5)
end

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