I want to make this script local

what do i mean with this im making like a skybox changer when the propieties, Atmosphere changes but the problem is when i play alone is good but someone joins and the skybox changes to normal for everyone like i wanna make this local only who is in that zone not everyone

sorry if my english is not that good

script.Parent.Touched:connect(function(hit)
	game.SoundService.Main.Day.Volume = 0.3
	game.SoundService.Main.Space.Volume = 0
	game.SoundService.AmbientReverb = "City"
	game.Workspace.Gravity = 196.2
	game.Lighting.Atmosphere.Density = 0.354
	game.Lighting.Atmosphere.Glare = 2.63
	game.Lighting.Atmosphere.Haze = 0.79
	game.Lighting.Sky.SkyboxBk = "rbxassetid://591058823" 
	game.Lighting.Sky.SkyboxDn = "rbxassetid://591059876"
	game.Lighting.Sky.SkyboxFt = "rbxassetid://591058104"
	game.Lighting.Sky.SkyboxLf = "rbxassetid://591057861"
	game.Lighting.Sky.SkyboxRt = "rbxassetid://591057625"
	game.Lighting.Sky.SkyboxUp = "rbxassetid://591059642"
	game.Lighting.Sky.SunTextureId = "rbxassetid://1345009717"
	game.Lighting.Sky.MoonTextureId = "rbxassetid://1345054856"
	game.Lighting.Sky.SunAngularSize = 40
	game.Lighting.ClockTime = 13.329
end)


In this specific case you can simply copy this into a LocalScript and it should do what you’re asking.

1 Like

i did that but It does not work i touch the part that is supposed to change the skybox and nothing

Is the touched event being called? Try printing at the start of the function.

Localscripts do not run in workspaces, put it startercharacter or starterplayer.

2 Likes

This is right. You will have to get the Part using WaitForChild in this case, since you can’t know for sure whether the part will have loaded before the script starts running, such as:

workspace:WaitForChild("SkyboxButton").Touched:connect(...)
1 Like

Set the run context of your script to client !
I hope that was helpful !
Have a nice day !

1 Like

thank you all guys i did fix it!!

1 Like

Don’t forget to put the solution as solution for to help other user to know what’s the solution !

1 Like