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

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

Asked by 5 years ago

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. ¯_(?)_/¯

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 vissequ 105 — 5y

1 answer

Log in to vote
0
Answered by
xg1y 41
5 years ago
Edited 5 years ago
 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)

0
Probally gonna have to figure out how to make the client event work. thanks though. :) RGamesDev 22 — 5y
Ad

Answer this question