Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 comment

0

you can just take a skybox then clone it in the lightning from serverstorage

1 answer

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.