How to change the lighting in roblox studio

This Platform uses cookies to offer you a better experience, to personalize content, to provide social media features and to analyse the traffic on our site. For further information, including information on how to prevent or manage the use of cookies on this Platform, please refer to our Privacy and Cookie Policy.

Help and Feedback Scripting Support

I want to try to change someone’s lighting settings so there is only fog for 1 person. I have tried

local player = game:GetService("Players").LocalPlayer local function onPartTouch(otherPart) player.lighting.fogend = 10 lighingpart.Touched:Connect(onPartTouch)

how would i make it so it changes only 1 persons fog?

1 Like

Try use a local script for that player

You can try doing it via a LocalScript. It won’t work on the server. You can use remote events to fire the client.

local Lighting = game:GetService'Lighting' local Players = game:GetService'Players' local LocalPlayer = Players.LocalPlayer local function OnTouched(Touched) local Player = Players:GetPlayerFromCharacter(Touched.Parent) if Player and Player == LocalPlayer then Lighting.FogEnd = 10 end end -- Change path to LightingPart LightingPart.Touched:Connect(OnTouched)

3 Likes

Help and Feedback Creations Feedback

Currently I’m making a game and in the beginning I altered the lighting quite a lot, but now that I’m further in I don’t like how the lighting looks with the main colors. Is there a way to automatically revert back to the default lighting settings or do I have to manually do that?

Hey there👋 @Kevasii! If you still haven’t figured out if there was an automatic way I would recommend opening a baseplate and copying the lighting settings to your current game.

How to change the lighting in roblox studio

1 Like

https://www.roblox.com/library/2848216210/LightPlus

I would suggest using this plugin. It allows you to save lighting presets as well as reset the lighting to how it was in its default state. Very useful.

3 Likes

Help and Feedback Scripting Support

Howdy!
I’ve been wondering for the past few days and looking upon the devforum on how I should do the following:

If you press a GUI button, it changes a property or properties of lighting.
For example: if You pressed the button, it would change the blur intensity to from 0 to 1.

I’m not a scripter what so ever, so if someone could help me with how I would go about it that would be very much appreciated.

2 Likes

Do you want the blur to be changed for the player or for everyone?

2 Likes

Player, I should of specified that.

1 Like

put this in a local script inside the GUI button

local tb = script.Parent.TextButton tb.MouseButton1Down:Connect(function) game.Lighting.Blur.Size = 1 end) --thats it

if it doesn’t work
tell me what happens in the output please

signed,
X

3 Likes

Not sure if Blur.Intensity will work. Use Blur.Size.

1 Like

local Button = script.Parent.TextButton Button.MouseButton1Click:Connect(function() local Blur = game.Lighting.Blur Blur.Size = 1 end)

1 Like

Thanks for the clarification. I dont really touch lighting with scripts.

1 Like

Thank you all who decided to help, I’m very grateful!

2 Likes

Hiwi!

Okie, I made your script, and I want to help you to connect it. Just follow these steps.

BTW, I checked your Teleport script, and its good, but its triggering at least 4 times… And thats not good. (Brief explanation)
The characters are made of many parts, and the Touch event, gets the Touch Event PER part inside the character. Everytime a part is found your function is cheking the part’s parent to find a Humanoid… And it will find a Humanoid maybe +16 times… Triggering “something” +16 times… Which you and nobody wants to that happen…

So I changed it completely. I dont know the “best” approach. I just use this approach cause I like it. I only compare if the Hit part.Name its a HumanoidRootPart. We have only 1 HumanoidRootPart inside the characters, so its convinient. Triggers only once.

1- The only one inconvinient, is that you gotta make a “tall” invisible boundary box to check the Touch event, heres some pics: (make it enough tall to hit the full body, and you can make it totally invisible, and keep a small part or something you want as a “Teleport model”)

How to change the lighting in roblox studio

2- You need to create a RemoteEvent and place it inside ReplicatedStorage, name that RemoteEvent “LightEvent”
And you need to place at least the SunRays inside lighting.

How to change the lighting in roblox studio

3- Place this Script inside the BoundaryBox:

-- Services -- Parent ReplicatedStorage local RepS = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") -- RemoteEvents local LE = RepS:WaitForChild("LightEvent") -- Coordinates to TP local place = CFrame.new(-719.318, 525.448, 340.759) -- On touch a boundary invisible box. Should be tall enough to be touched by the HumanoidRootPart script.Parent.Touched:connect(function(hit) if hit.Name == "HumanoidRootPart" then -- Make sure the function trigger ONLY ONCE, only when the HumanoidRootPart is found local hitPlayer = Players:GetPlayerFromCharacter(hit.Parent) -- Get the Player instance from HRP touched hitPlayer.Character.HumanoidRootPart.CFrame = place -- Moving the HumanoidRootPart LE:FireClient(hitPlayer) -- Fire Client Event for only the player who touched the box end end)

4- Place this LocalScript inside StarterPlayerScripts

-- Services -- Parent ReplicatedStorage local RepS = game:GetService("ReplicatedStorage") local LE = RepS:WaitForChild("LightEvent") -- RemoteEvents local LE = RepS:WaitForChild("LightEvent") -- Lighting Main Parent local sun = game.Lighting -- Parenting the Atmosphere local sunRays = sun.SunRays -- Initial SunRays Values for the player when joins -- Change them to anything you want sunRays.Intensity = 1 sunRays.Spread = 0.6 -- Function, it will change the Intensity and Spread of SunRays local function mainLight() sunRays.Intensity = 0 -- Change this values to anything u want sunRays.Spread = 0 -- Change this values to anything u want end -- Listener, when Server calls the LightEvent it will fire the function above LE.OnClientEvent:Connect(mainLight)

5- Change values inside the LocalScript to the ones you want for SunRays.
Theres a part in the LocalScript called – Initial SunRays values. Those are the initial values the player gets when join the server. And change the sunRays.Intensity and Spread values inside the function mainLight() to the ones you want after the player teleports.
Just change the number to the values you want. from 0 to 1. I just used total 0 after the player Teleports. Customize it as you wants.

How to change the lighting in roblox studio

If you did everything right, thats it! If you need to connect more parameters to change, feel free to ask, I can show you how u can change any. Good luck, cya! :3