Hello, I’m trying to make a text button that when you clicked it, it changes the time/lighting/ambience/tintcolor/brightness to the numbers in the code. But, it doesn’t seem to work, if anyone can help me figure out why it wouldn’t work that would be a great help.
This is a GUI with a text button that changes setting of the day like the time and lighting.
local colorcorrection = Instance.new('ColorCorrectionEffect',game.Lighting)
local lightingsunset = game.Lighting
local lightingsuncorrection = colorcorrection
local clocksuntime = game.Lighting.ClockTime
script.Parent.MouseButton1Click:Connect(function()
lightingsunset.Ambient = Color3.fromRGB(1,1,1) -- this is the rgb color
-- Lighting fog setting
lightingsunset.FogColor = Color3.fromRGB(1,1,1) -- this is the rgb color
-- Lighting brightness
lightingsunset.Brightness = 60
-- Color correction setting
lightingsuncorrection.Contrast = -0.1
lightingsuncorrection.TintColor = Color3.fromRGB(255, 131, 69)
lightingsuncorrection.Saturation = -0.1
lightingsuncorrection.Brightness = 0.1
-- Clock time setting
clocksuntime = 17.6
end)
you can not use or assign the values without adding = in between. and for color you have to add what type of color u r using e.g rgb, hsv etc.
i have fixed your script for you. so you can use it and hopefully understand it better.
To make this code more efficient I would use it in a function all the settings for the Lighting service and just connect it on the textbutton activated function like this.
--// Services \\--
local Lighting = game:GetService("Lighting")
--// Variables \\--
local Button = script.Parent:WaitForChild("Button")
--// Functions \\--
local function SetLighting()
-- Add all the settings needed here
end)
--// Events \\--
Button.MouseButton1Clicked:Connect(function()
SetLighting()
end)