Hello,
My question is, How can I make a GUI so that when you insert a player’s name it sends you to their place within your game?
I have no clue how to do so.
Thank you.
Hello,
My question is, How can I make a GUI so that when you insert a player’s name it sends you to their place within your game?
I have no clue how to do so.
Thank you.
I don’t know how your GUI is made so I cannot help that much but consider making a remote event.
To teleport a player to a different place, this is the code.
local TeleportService = game:GetService("TeleportService")
TeleportService:Teleport(placeID, player)
Alrighty, Ill check this out!
Thank you!
try this
local player = game.Players.LocalPlayer
local TeleportService = game:GetService("TeleportService")
local world = yourid
TeleportService:Teleport(world, player)
Ok, I will! Thank you!
:DDDDDDD
if your doing gui thing do this
local TeleportService = game:GetService("TeleportService")
local world = yourid
local StarterGui = game.StarterGui
StarterGui.TextButton.MouseButton1Click:Connect(function()
TeleportService:Teleport(world, player)
end)
put this script in the starterplayerscript folder under a local script and then make the textbutton i set what you named the gui you want them to click
If you want to teleport to a certain player you should be able to do this. You’ll need a server-sided script (serverscriptservice) since GetPlayerPlaceInstanceAsync does not work on the client. You’ll also need a RemoteEvent (replicatedstorage)
Here’s the LocalScript for the UI
Just change the TextBox to whatever it is in your UI
script.Parent.TextBox.InputEnded:Connect(function()
pcall(function()
local vUserId = game.Players:GetUserIdFromNameAsync(script.Parent.TextBox.Text)
if vUserId then
game.ReplicatedStorage.TeleportToPlayer:FireServer(vUserId)
end
end)
end)
Here’s the server Script
local TS = game:GetService("TeleportService")
game.ReplicatedStorage.TeleportToPlayer.OnServerEvent:Connect(function(Plr, ID)
local PlaceId, JobId = TS:GetPlayerPlaceInstanceAsync(ID)
if PlaceId and JobId then
TS:TeleportToPlaceInstance(PlaceId, JobId, Plr)
end
end)
Ok!! Ill try this, thank you!!!
Just tested it, and it didn’t TP me.
It will only work if the player is in the same game but different place
just tested it with my alt account, they were in a separate place, but it didn’t tp me.
is there an extra setting I need on?
if your trying to teleport them to different games like from your game to other game you can’t you need to go into a setting and make another place. Here hows to do it go into game explore in studio and you will see a places folder click it and add a new place once you done that right click and hit copy id.
yes, I know how to do that. Im just trying to teleport a player to a separate place within the game.
This should work just replace your id with the games id also set textbutton to the name of the button you want them to hit
Im simply trying to make it to it teleports you to a requested player’s server. even if you are not friends with them. : p
oh sorry idk what to code then but you have to get the player to see if there online in the game and then see if the game has an open spot and then teleport them to that server.
Alright, thanks for the help!
(30 letters.)
try this
local script
local TextButton = -- Your TextButton
TextButton.MouseClick1Down:Connect(function())
game.ReplicatedStorage.Teleporting:FireServer()
end
server script
local player = -- your player
local TeleportPart = -- your tele part
local Offset = CFrame.new(0,4,0)
game.ReplicatedStorage.Teleporting.OnServerEvent:Connect(function(player)
player.Character.PrimaryPart.CFrame = TeleportPart.CFrame * Offset
end
I mean, let me give an example,
Im on the main hub (the starting place.)
and I want to join a random player on a separate place within the game.
So I enter their name and press join.
:DDDD