Data set with the TeleportService:SetTeleportSetting method during a play test session in Studio is not cleared upon stopping the game and testing again. Data from previous play test sessions is retrievable with TeleportService:GetTeleportSetting.
This feels unintentional because game state from one play test session shouldn’t carry over to another, all tests should start from a blank slate, otherwise the user will experience unexpected results while debugging code using these methods.
Bug repro file: TeleportService_Setting_Bug.rbxl (16.6 KB)
Steps:
- Open the provided repro file.
- Click Play and see that the TextLabel on top is “nil”.
- Click the “Save data button” which will save the teleport setting.
- Click Stop.
- Click Play.
- The saved data from the previous play session will appear on the TextLabel.
Additionally: The documentation for TeleportService:GetTeleportSetting claims that the method will return nil
when there is no data saved, but this is not the actual behavior. This method returns no value at all, or void
. Other members of the Roblox API actually return the value nil
, such as FindFirstChild. Typically, this is indistinguishable in Lua, but the problem can be demonstrated here:
tostring(game:GetService("TeleportService"):GetTeleportSetting("Testing"))
--> 02:45:23.891 - bad argument #1 to 'tostring' (value expected)