Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

FilteringEnabled fog no errors ?

Asked by
IcyEvil 260 Moderation Voter
6 years ago

No clue whats wrong to be 100% honest, no errors or anything.

game.ReplicatedStorage.Fog.OnServerEvent:Connect(function()
    local fogcolor = {67, 67, 67} -- change to the color you want it to be lmao
    local fogend = 50 -- change to the amount of fog end you want
    local fogstart = 0 -- change to the amount of fog start you want

game.Lighting.FogColor = fogcolor
game.Lighting.FogEnd = fogend
game.Lighting.FogStart = fogstart
end)
0
Where is this script located? PyccknnXakep 1225 — 6y
0
Regular script is located in workspace. Local script is located within ServerScriptService IcyEvil 260 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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 --wherever your event is
re:FireServer() --FireServer can only be used in the Client

Server Script in ServerScriptService:

local re = game:GetService("ReplicatedStorage").RemoteEvent
re.OnServerEvent:Connect(function() --OnServerEvent can only be used in the Server
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.

0
Thanks IcyEvil 260 — 6y
Ad

Answer this question