#skybox changes in specific areas
1 messages · Page 1 of 1 (latest)
Hey
I'll help y
**So To make the Skybox change client-side when a player enters a specific area, you'll want to do the following:
-
LocalScript inside StarterPlayerScripts.
-
Touched or Region3 or ZonePlus to detect the area.
-
Custom Sky instance for your new skybox.
-
Client-side only (to not affect all players).**
So I'll give you quickest methode
**1. In Workspace:
Add an invisible, non-collidable Part (e.g., called "SkyTrigger") that marks the area.
- In ReplicatedStorage:
Add a Sky object with your custom skybox images., and name it "CustomSky"**
and this is the LocalScript must be in (StarterPlayerScripts):
local trigger = workspace:WaitForChild("SkyTrigger")
local customSky = game.ReplicatedStorage:WaitForChild("CustomSky"):Clone()
local player = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
local inZone = false
trigger.Touched:Connect(function(hit)
if hit.Parent == player.Character and not inZone then
inZone = true
for _, v in pairs(cam:GetChildren()) do
if v:IsA("Sky") then v:Destroy() end
end
customSky:Clone().Parent = cam
end
end)
trigger.TouchEnded:Connect(function(hit)
if hit.Parent == player.Character then
inZone = false
for _, v in pairs(cam:GetChildren()) do
if v:IsA("Sky") then v:Destroy() end
end
end
end)
thank you so much bro ill try it out
You're Welcome, this is my job 😉
btw, is zone plus a roblox plugin or github?
** You are now Level 1! **
ZonePlus is a free Roblox module (not a plugin) you can add to your game by importing it from the Roblox library (Marketplace) or via its official page.
Roblox Marketplace page:
https://create.roblox.com/marketplace/asset/6883141283/Zone-Module
How to use:
1. Insert ZonePlus ModuleScript into ReplicatedStorage.
2. Require it in your server or local scripts:
local ZonePlus = require(game.ReplicatedStorage.ZonePlus)
3. Define zones by size and position, then listen to .Touched, .SteppedIn, .SteppedOut events per player.
this line goes in my local script in starterplayerscripts right?
**# No, that line :
should not go in a LocalScript inside StarterPlayerScripts by default, it depends on where and how you want to use ZonePlus:
-
If you want to detect zones for a single player on their client only (client-side detection), then yes, put that line in a LocalScript inside StarterPlayerScripts or similar client context.
-
If you want to do zone detection on the server for all players globally (server-side logic), then put that line in a Script in ServerScriptService or wherever your server scripts run.**
so in starterplayerscripts one local script for the specific sky, and one for the zoneplus?
im doing client sided
sorry just gotta make sure im doing this right
** # Exactly! For client-sided detection and effects, your setup in StarterPlayerScripts would look like this:
-
One LocalScript for handling the ZonePlus zone detection, this script requires the ZonePlus module and detects when the player enters or leaves the zone.
-
Another LocalScript (or part of the same script) for changing the Skybox and playing music when the player is inside that zone.**
these are the 2 scripts im using, but for some reason it isnt working
i did name the part SkyTrigger, is there anything i need to add to one of these codes or change in the original ZonePlus scripts?
** You are now Level 7! **
You're not using ZonePlus at all , you're still relying on basic .Touched, which is unreliable for player detection and doesn't work consistently with HumanoidRootPart or characters due to physics glitches.
I'll code u wokring script
ur welcome
local ZonePlus = require(game.ReplicatedStorage:WaitForChild("ZonePlus"))
local triggerPart = workspace:WaitForChild("SkyTrigger")
local customSky = game.ReplicatedStorage:WaitForChild("CustomSky")
local player = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
local zone = ZonePlus.new(triggerPart)
zone.playerEntered:Connect(function(localPlayer)
if localPlayer == player then
for _, v in pairs(cam:GetChildren()) do
if v:IsA("Sky") then v:Destroy() end
end
customSky:Clone().Parent = cam
end
end)
zone.playerExited:Connect(function(localPlayer)
if localPlayer == player then
for _, v in pairs(cam:GetChildren()) do
if v:IsA("Sky") then v:Destroy() end
end
end
end)
Try it now, should works now
mmm, let me check and analyze the errors
did u notice anything?
** You are now Level 2! **
sorry, I was offline
I knew the probelm
Your script is waiting forever for the ZonePlus module because it does not exist (or is misnamed) in ReplicatedStorage!!
Make sure in ReplicatedStorage a ModuleScript named exactly ZonePlus
(spelled exactly, with uppercase Z and P)
Go to this link:
https://create.roblox.com/marketplace/asset/6883141283/Zone-Module
Click “Get” → it will go to your toolbox.
In Studio, open the Toolbox → drag the ZonePlus module into ReplicatedStorage.