0

# How To Make The SkyBox Change When A Player Is In A Certain Region?

Asked by 7 days ago

Hey Devs I Wanted To Ask On How Do I Make The Sky Box Change When The Player Is In A Area And Then When He Leaves The Area The Sky Box Changes Back To What It Was. Similar Function can Be Seen In The Game Epic Minigames

0
you can just take a skybox then clone it in the lightning from serverstorage acediamondn123 73 — 7d

0
DJhar09 90
5 days ago

Server:

local regionPart = nil -- replace nil with your part
local region3 = Region3.new(regionPart.Position - (regionPart.Size * 2), regionPart.Position + (regionPart.Size * 2)) -- converts to regoin3

local skybox = nil -- change to skybox
local skyboxClient = game.ReplicatedStorage.ChangeSkybox -- add this remote event to replicated storage

while wait(1) do -- loop
local partsInRegoin = workspace:FindPartsInRegion3(region3, nil, game.Players.MaxPlayers * 25) -- gets parts in regoin

for i, part in ipairs(partsInRegoin) do -- loop through the parts
local player = game.Players:GetPlayerFromCharacter(part.Parent) -- get the player

if player then -- check if it's a player
skyboxClient:FireClient(player, skybox)
end
end
end



Client:

game.Players.LocalPlayer.CharacterAdded:Wait() -- load the game

game.ReplicatedStorage.ChangeSkybox.OnClientEvent:Connect(function(skybox)
skybox.Parent = game.Lighting
end)


Make sure to add the remote event "Change Skybox" in replicated storage!