Ok, so here's my current issue.
In my game I have 3 separate scripts, where if you're within a certain range of a coordinate, it changes your Skybox and some lighting variables, and if you go out of range of it then it sets the players back to the first Skybox they had.They are all local scripts found under the StarterGUI folder, which - in my knowledge - meant that the changes will only be seen by the LocalPlayer.
First Script:
local player = game.Players.LocalPlayer local radius = 3000 while true do if player:DistanceFromCharacter(Vector3.new(53.007, -103.993, 32.019)) < radius then print("Player is within radius") script.Parent.AreaChange.Disabled = false wait(1) else print("Player is out of range") script.Parent.AreaChange2.Disabled = false wait(1) end end
Second Script (AreaChange):
skych = game.Lighting.Sky if skych.SkyboxBk == "http://www.roblox.com/asset/?version=1&id=1013852" then print("Already set to sky") script.Disabled = true else skych.SkyboxBk = "http://www.roblox.com/asset/?version=1&id=1013852" skych.SkyboxDn = "http://www.roblox.com/asset/?version=1&id=1013853" skych.SkyboxFt = "http://www.roblox.com/asset/?version=1&id=1013850" skych.SkyboxLf = "http://www.roblox.com/asset/?version=1&id=1013851" skych.SkyboxRt = "http://www.roblox.com/asset/?version=1&id=1013849" skych.SkyboxUp = "http://www.roblox.com/asset/?version=1&id=1013854" game.Lighting.Ambient = Color3.fromRGB(117, 78, 0) game.Lighting.FogColor = Color3.fromRGB(152, 76, 0) game.Lighting.FogEnd = 500 wait(1) print("Script Disabled") script.Disabled = true end
The third script (AreaChange2) is essentially the same as AreaChange, save that it uses different Skybox URL's. (I'm using the while loop method as that's the only method I fully comprehend atm so I added the if statement in the second and third scripts)
Now to the heart of the issue. So whenever it's used in a game with 2 or more people playing, and 1 person is within range while another is out of range, it flips back and forth between the Skyboxes, as though it was a global function instead of a local one. This leads me to ask two questions: 1) Is there an error in my script? and 2) Do the Skybox and Lighting Classes only function as global classes instead of local ones?
I think you have to use rbxassetid:// instead of https:// im not really sure