✓ Accepted answer
Here's the problem. You cannot put LocalScripts inside of the server script service as they will not function. Also, you were missing Color3.new on line 2.
LocalScript in StarterGui:
local re = game:GetService("ReplicatedStorage").RemoteEvent
re:FireServer()
Server Script in ServerScriptService:
local re = game:GetService("ReplicatedStorage").RemoteEvent
re.OnServerEvent:Connect(function()
local fogcolor = Color3.new(67/255,67/255,67/255)
local fogend = 50
local fogstart = 0 -
game.Lighting.FogColor = fogcolor
game.Lighting.FogEnd = fogend
game.Lighting.FogStart = fogstart
end)
Please accept my answer if this helped!
The reason why the LocalScript is in the StarterGui is because LocalScripts cannot function in services like the workspace, serverscriptservice, etc. They can only run in client-based services like PlayerGui, StarterGui, StarterPack, etc.
2 comments
Where is this script located?
Regular script is located in workspace. Local script is located within ServerScriptService