Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function module.loadMap()
- for world, worldData in pairs(ServerData.worldsData) do
- if not worldData.Playable then
- continue
- end
- local WorldMap = ReplicatedStorage.Builds:FindFirstChild(world):Clone()
- WorldMap.Parent = workspace
- WorldMap.Name = worldData.Name
- -- Store the menus inside worldData.Menus
- spawn(function()
- while true do
- for _, menu in pairs(WorldMap.Menus:GetChildren()) do
- worldData.Menus[menu.Name] = menu
- end
- task.wait(1)
- end
- end)
- end
- module.menus()
- end
- function module.menus()
- spawn(function()
- while true do
- task.wait(0.1)
- -- Iterate over players in the game
- for _, player in pairs(game.Players:GetPlayers()) do
- if player.Character then
- -- Iterate through each worldData to check its menus
- for _, worldData in pairs(ServerData.worldsData) do
- for _, menu in pairs(worldData.Menus) do
- -- Check if the player is touching the menu
- if module.areObjectsTouching(player.Character.HumanoidRootPart, menu) then
- if menu.Name == "WorldSelectorPortal" then
- player.PlayerGui.MainGui.WorldSelector.Visible = true
- repeat task.wait()
- until not module.areObjectsTouching(player.Character.HumanoidRootPart, menu)
- player.PlayerGui.MainGui.WorldSelector.Visible = false
- end
- end
- end
- end
- end
- end
- end
- end)
- end
- module.loadMap()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement