Hello developers. I have a game that I am attempting to allow only players coming from a game teleport to join. I am using TeleportService.LocalPlayerArrivedFromTeleport:Connect(function() in a local script, but it is not working for some reason. I have searched for some solutions and even attempted some workarounds, but they did not work for me. What can I do to accomplish my goal? Here is my code block I am attempting to do:
TeleportService.LocalPlayerArrivedFromTeleport:Connect(function()
print("Player Data Received.")
script.Kick:Destroy()
local data = TeleportService:GetLocalPlayerTeleportData()
if data == "AccessDenied" then
player.PlayerGui.AccessDeniedGui.Enabled = true
game.ReplicatedFirst.AccessDeniedScript.Disabled = false
end
if data == nil then
player.PlayerGui.TeleportGui.Enabled = true
game.ReplicatedFirst.RestartScript.Disabled = false
end
end)