How to make a friend teleport script in the same universe? (Issues)
Asked by
7 years ago Edited 7 years ago
PROBLEM
It only allows me to teleport to people in the exact same server that i'm trying to teleport from.
useless right? I would greatly appreciate some help.
DESC
I tried to make a feature that uses the typed name of a player, fires it to the server, and gets their UserId to begin the first part.
2 | game.ReplicatedStorage.Events.TeleportToFriend.OnServerEvent:Connect( function (Player,Who) |
5 | FriendId = game.Players:GetUserIdFromNameAsync(Who) |
7 | FollowFriend(Player,FriendId) |
The second part of the script is the one following the friend's named they typed.
1 | function FollowFriend(player, targetUserId) |
2 | local teleportService = game:GetService( "TeleportService" ) |
3 | local success, errorMsg, placeId, instanceId = teleportService:GetPlayerPlaceInstanceAsync(targetUserId) |
5 | teleportService:TeleportToPlaceInstance(placeId, instanceId, player) |
7 | print ( "Teleport error:" , errorMsg) |
However this is where it won't let me teleport to anyone outside of my server?
Any suggesstions? Any help appreciated