Studio & Game instantly crash

Game Behavior: when you try to teleport to any place within the experience (Leaving “The City” place) The game instantly crashes no matter what [All Players are experiencing this]

Studio Behavior: Testing the game functions correctly but upon pressing the stop button the studio app just closes without any warnings or freezes prior and it’s happening to all devs that are working on this. we have tried multiple solutions before such moving the game to a new place in studio and it worked the crashes stopped but that was in test place aka dev place we cant do this for the main game. one note that this issue never happened in game before which is why we were silent about it but now it happens in game too and is affecting players and we are losing them

Game link: RoCast Online - Roblox

Studio Video: Watch 2025-02-22 14-40-22 | Streamable

Expected behavior

Studio to run again normally after stop, Game to teleport to other places normally

1 Like

Very unclear reproduction steps, I spent around 10 minutes just trying to get to the location of where your reported bug occurs. How are you handling teleportation?

1 Like

The reproduction steps are as simple as: You just go in game, teleport to the city. press on the button from the menu on top you either return to menu or Trading or u could even enter a dungeon.

in this game you cant access the city till you finish the tutorial so I do understand why you would take time. about how I handle teleportation here is the code:

function Quests.TeleportToPrivatePlace(Players, teleportToPlace, attempts, KickOnFail, Freeze)
	if typeof(Players) ~= "table" then
		Players = {Players}
	end
	if Freeze then
		for _, Player in ipairs(Players) do
			local PrimaryPart = Player.Character and Player.Character.PrimaryPart
			if PrimaryPart then
				PrimaryPart.Anchored = true
			end
		end
	end
	if KickOnFail == nil then
		KickOnFail = true
	end
	attempts = attempts or 1
	local placeId = Functions.Places[teleportToPlace]
	if placeId then
		local succ, err = pcall(function()
			--RemoteEvent:FireClient(Player, "SetTeleportGui", teleportToPlace)
			print(workspace:GetAttribute("ServerCode"), "TELEPORTINGGGG")
			local ReservedServerAccessCode, privateServerId = TeleportService:ReserveServer(placeId)
			
			local Gui = Assets.Guis.Places:FindFirstChild(teleportToPlace)
			for _, Player in ipairs(Players) do
				if Gui and Player:FindFirstChild("PlayerGui") then
					Gui = Gui:Clone()
					Gui.Parent = Player.PlayerGui
				end
			end
			
			local serverCode = workspace:GetAttribute("ServerCode") or workspace:GetAttribute("OriginCode")
			if not serverCode then
				print("NO CODE!")

				TeleportService:TeleportToPrivateServer(placeId, ReservedServerAccessCode, Players, nil, nil, Gui)
			else
				local memoryStoreQueue = game:GetService("MemoryStoreService"):GetQueue(privateServerId, 120)
				memoryStoreQueue:AddAsync(workspace:GetAttribute("RestrictedAccessCode"), 120) -- 120 for the same reasons as above
				memoryStoreQueue:AddAsync(serverCode, 120)
				
				--local teleportOptions = Instance.new("TeleportOptions")
				--local teleportData = {
				--	ReservedServerAccessCode = ReservedServerAccessCode
				--}
								
				--teleportOptions:SetTeleportData(teleportData)
				
				--TeleportService:TeleportPartyAsync(placeId, Players, teleportOptions)
				TeleportService:TeleportToPrivateServer(placeId, ReservedServerAccessCode, Players, nil, {game.PrivateServerId, game.PlaceId, workspace:GetAttribute("ServerCode"), workspace:GetAttribute("RestrictedAccessCode")}, Gui)
			end

		end)

		if succ then
			print("Teleport Succeeded", succ)
		end
		if err then
			for _, Player in ipairs(Players) do
				Quests.EndQuest(Player)
			end
			warn("Teleporting Error:", err)
			if attempts > 1 then
				print("Trying Again...")
				Quests.TeleportToPrivatePlace(Players, teleportToPlace, attempts-1)
			elseif KickOnFail then
				for _, Player in ipairs(Players) do
					if game:GetService("RunService"):IsStudio() then break end
					
					Player:Kick("An Error Occured Please Try Rejoining.")
				end
			elseif Freeze then
				if Freeze then
					for _, Player in ipairs(Players) do
						local PrimaryPart = Player.Character and Player.Character.PrimaryPart
						if PrimaryPart then
							PrimaryPart.Anchored = false
						end
					end
				end
			end
		end
	else
		warn("Place id not found:", teleportToPlace)
	end
end

Even add onto that the leave button in the ROBLOX’s escape menu usually makes people go to the home page in the app. but when you press it after you completely load into The City, It freezes your game for about 3 seconds and then closes ur game completely

Update: we have managed to prevent it from happening by disabling/destroying most of the clientscripts on player removing event
it limits us a little but its a bandaid fix for now at least so players can play