Suggestion: Add a property such as ‘Player.TeleportedFrom’ that holds the PlaceId that the given player teleported from.
Issue: Using Game Universes, my “hub” place acts as like a menu page for players. When the player joins, an introduction animation is played. The problem though, is that I don’t want the animation playing every single time the player is re-teleported to the hub place. A nice solution would be a way to tell that the player has teleported into the game.
I’ve tried using DataStores, saving a ‘os.time()’ value when the player teleports. Unfortunately, this does not update quick enough for the hub place to see.
Or say I have a place on a planet in which players can enter from space, by train, or by boat (all separate places in a universe) – knowing which place they entered from would help me determine whether to spawn them in at the docks, the train station, or the space docks.
[quote]
I’ve tried using DataStores, saving a ‘os.time()’ value when the player teleports. Unfortunately, this does not update quick enough for the hub place to see. [/quote]
Are you using UpdateAsync or GetAsync? Because UpdateAsync is obviously too slow.
It’s a shame because we could kind of do this with TeleportService already by directing the player to a specific spawn. In Crazyman’s case he could teleport players to a noIntro spawn or something, and then not play the intro if that was where the character had spawned. This may not sound like a shame, in fact it sounds wonderful, until you remember “Oh wait, the spawns have to be neutral so that means anyone can spawn there even if I don’t tell them too. Thanks [strike]Obama[/strike]ROBLOX!”
Is TeleportService:GetPlayerPlaceInstanceAsync() up-to-date?
Because if it isn’t, you can (ab)use that to see from where someone came (inside your inv)
[quote] Is TeleportService:GetPlayerPlaceInstanceAsync() up-to-date?
Because if it isn’t, you can (ab)use that to see from where someone came (inside your inv) [/quote]
That’s the place they’re currently in – not the place they came from. If you call that while they’re in the menu place, it’ll return a server of the menu place.
[quote] Is TeleportService:GetPlayerPlaceInstanceAsync() up-to-date?
Because if it isn’t, you can (ab)use that to see from where someone came (inside your inv) [/quote]
That’s the place they’re currently in – not the place they came from. If you call that while they’re in the menu place, it’ll return a server of the menu place.[/quote]
I hoped for lag so you could see that way from where they came…
Can always use SetAsync on leaving one place, and on join use UpdateAsync for the most up-to-date data.
(and SetAsync should be fast enough? could always set the data, play a short animation, THEN tp the player)
[quote]
The change is committed from the current server, but the other server doesn’t know about the update yet because there’s a deliberate 60-second lag. [/quote]
I thought the 60-second delay was with UpdateAsync? I specifically said to use GetAsync to bypass this altogether.
I can confirm that SetAsync and GetAsync post almost instantly.
I still give my clients about a five second wait time before teleporting just to be safe.
Once the call to SetAsync finishes successfully, you can immediately teleport the player. There is absolutely no reason to wait as far as data stores go.
I managed to get SetAsync to work for what I want. Still, the property would be nice.
For some reason, the OnTeleport event on the player was not firing or something. The teleport was done on the client, an the event was hooked up on the server. Perhaps that was the issue? Anyway, I just linked the teleport button to a RemoteEvent which then forces the SetAsync save.