Hello, I want to know how I could somehow make maps with different skyboxes and a specific time of day, take Evade for example, they have many maps with different looking skies and time of day.
I don’t know if I would just need to place the skybox in the map itself but I don’t think they would show up.
Best i could say is create a string value and do this:
local lighting = game:GetService("Lighting")
local Maps = game:GetService("SeverStorage").Maps:GetChildren()
local MapTable = {}
table.insert(MapTable, Maps)
function SetMap ()
for _,Map in pairs(MapTable) do
local RM = MapTable[math.random(1, #MapTable) do
local A = RM:Clone() A.Parent = workspace.Map_Workspace
lighting.Sky.SkyboxBk = A.SkyBoxBk.Value
lighting.Sky.SkyboxDn = A.SkyBoxDn.Value
lighting.Sky.SkyboxFt = A.SkyBoxFt.Value
lighting.Sky.SkyboxLf = A.SkyBoxLf.Value
lighting.Sky.SkyboxRt = A.SkyBoxRt.Value
lighting.Sky.SkyboxUp = A.SkyBoxUp.Value
end
end
Not Really sure as i dont use the Skybox
You can probably do Sky:Clone() and put it inside lighting with the settings
If there was a lobby and only 6 out of the 10 players were teleported to the map. That could cause problems if those 4 people also wanted to make a game then the skybox would change accordingly and that would mess with the 1st group. I don’t know the context of the game so you might be right and it could be a bad idea.
local AlivePlayers = {}
for _,Players in pairs(game.Players:GetPlayers()) do
table.insert(AlivePlayers, Players)
Players.Character:WaitForChild("Humanoid").Died:Connect(function()
table.remove(AlivePlayers)
end)
end)
Edit: i didnt read your post right.
Either way, you can change it on the server, not the Client to prevent that issue
You could also use local scripts to set the skybox, but I would just use teleport service. There could also be the issue of where the map is spawned. If one game is already started then the next game would have to be placed away from it, so the players couldn’t see each other and especially not be spawned on top of each other.
Edit: Changing the skybox on the server would make it display for everyone which is an issue
You’re right, but like you said, that would cause issues.
Not Exactly, you can always do :ClearAllChildren() to remove the map from the area once the game is finished
Not Sure why you would have 2 seperate games.
Thats the point, for a specific map you can change the SkyBox for everyone depending on the map, so if a new player joins, the lighting is already set from the map for the player to see.
Once you teleport your Player to a map, send a remote event from Server → Client telling them they have teleported and to clone the lighting for said map.
Server:
-- Teleport the player then notify the player they have been teleported and to update their Skybox/Lighting
remoteEvent:FireClient(player, "Map1")
Client:
remoteEvent.OnClientEvent:Connect(function(nameOfMap)
-- nameOfMap == "Map1" or "Map2"
-- Find the folder under Lighting
local lightingFolder = Lighting:FindFirstChild(nameOfMap)
-- Clones all the children under the Folder and parents it under Lighting for the player
for _, lightingEffect in ipairs(lightingFolder:GetChildren()) do
local newLightEffect = lightingEffect:Clone()
newLightEffect.Parent = Lighting
end
-- Now, set the attribute settings we have set under the Folder, and apply them to Lighting
local lightingSettings = lightingFolder:GetAttributes()
for attributeName, value in pairs(lightingSettings) do
if Lighting[attributeName] then
Lighting[attributeName] = value
end
end
end)
Oh I see what you’re saying now. Yeah that would be the best solution if the game was everyone in the lobby was teleported to a game. I was thinking more like a doors lobby where you get into separate games from a lobby. It all depends on how OP wants to make their lobby.