Unable to cast value to Object

So, im trying to make a game sharing game, so you can share your places and players would join but the teleport is not working (this is a simple script that is controlled), i tried doing tonumber() but everytime nothing works

for i,place in pairs(games) do
		if place then
			local icon = "https://games.roproxy.com/v1/games/"..place.id.."/icon"
			local data1 = game.HttpService:JSONDecode(game.HttpService:GetAsync("https://games.roproxy.com/v1/games?universeIds="..place.id))
			local rootPlaceId = tonumber(data1["data"][1]["rootPlaceId"])
			local data = game.HttpService:JSONDecode(game.HttpService:GetAsync(icon))
			local imageId = data["imageId"]
			
			if imageId then
				local clone = script.Frame:Clone()
				clone.Parent = workspace.Part.SurfaceGui.Frame
				clone.ImageLabel.Image = "rbxassetid://"..imageId
				clone.Join.MouseButton1Click:Connect(function()
					game["Teleport Service"]:TeleportAsync(rootPlaceId, player)
				end)
			else
				local clone = script.Frame:Clone()
				clone.Parent = workspace.Part.SurfaceGui.Frame
				clone.Join.MouseButton1Click:Connect(function()
					game["Teleport Service"]:TeleportAsync(rootPlaceId, player)
				end)
			end
		end
	end

Did you enable Allow Third Party Teleports on Studio?

Teleportation doesn’t work when you test out in roblox studio

i sloved it i used :Teleport instead of :TeleportAsync

1 Like

Cool! Congrats for solving the problem!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.