I’m trying to make a game where you create worlds in like in Blockate, But it doesn’t seem to work.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DataStoreService = game:GetService("DataStoreService")
local ServerScriptService = game:GetService("ServerScriptService")
local RunService = game:GetService("RunService")
local TeleportService = game:GetService("TeleportService")
local AssetService = game:GetService("AssetService")
local worldDS = DataStoreService:GetDataStore("Worlds")
local Events = ReplicatedStorage:WaitForChild("Events")
local CreateWorld = Events:WaitForChild("CreateWorld")
local PlayerData = ServerScriptService:WaitForChild("PlayerData")
local Manager = require(PlayerData:WaitForChild("Manager"))
local joiningWorld = false
local function createWorld(player : Player)
local worldCount = Manager.GetWorldCount(player)
local success, result = pcall(AssetService.CreatePlaceAsync, AssetService, "World", 13998441750, "A World Engine Game!")--AssertService:CreatePlaceAsync("World",13998441750,"A World Engine Game!")
if not result then
error(result)
end
print(result)
Manager.SetWorldData(player,result)
worldDS:SetAsync(result,{
WorldId = result,
Owner = player.UserId,
Name = player.Name.."'s World "..worldCount+1,
ActivePlayers = 0,
MaxPlayers = 20,
})
return result
end
CreateWorld.OnServerEvent:Connect(function(player)
if joiningWorld == false then
joiningWorld = true
local worldId = createWorld(player)
TeleportService:Teleport(player,worldId)
end
end)
This is the output
The game is in a group, and this was tested in a actual server.