Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I increase the fog in a Client with events?

Hi, I'm trying to do something within a horror game I'm making. Since the server is 5 players, I want to make it so if the player is in a specific part, It will raise the FogEnd amount.

Would it be something like this at the start?

local players = game:GetService("Players")
script.Parent.Touched:Connect(function(hit)
 if hit.Parent:FindFirstChild('Humanoid') then
  local player = Players:GetPlayerFromCharacter(hit.Parent)
  -- Mainly the Code to access Client Fog.
 end
end

Thanks for helping if you do decide to help with this. ¯_(?)_/¯

1 comment

0

You could do it that way, but I would probably detect if they are in the area by checking the distance they are away from a designated point. I believe you would then want to clone in a localscript to the target player and have this localscript adjust the FogEnd

1 answer

✓ Accepted answer
 local players = game:GetService("Players")
script.Parent.Touched:Connect(function(hit)
 if hit.Parent:FindFirstChild('Humanoid') then
  local player = Players:GetPlayerFromCharacter(hit.Parent)
 game.Lighting.FogStart = (values here)
 game.Lighting.FogEnd = (values here) 
 end
 end

You'd want the code in a local script in StarterPlayerScripts and simply just run whenever a client touches a said brick and then it causes lighting the change simply on the clients end, hopefully this works (Also remove the brackets)

1 comment

0

Probally gonna have to figure out how to make the client event work. thanks though. :)

This discussion is preserved as it was. New answers, comments, and votes are closed.