I’m working on a little experiment which consists of an in-game graphics menu, that gives the player more control over their game’s graphics beyond the built-in graphics slider. One of the settings is to modify a bloom effect. By placing a LocalScript into a GUI button, I connected a function to the clicked event to change the value of the bloom effect’s size.
The script doesn’t change the value, am I doing something wrong?
Numerical properties of instances are passed by value, not reference. I actually believe this applies for all (or mostly all) properties if I’m correct.
Super easy to fix that. Just index the Size property of the Bloom object inside of your event function.
local Lighting = game:GetService('Lighting')
local Blur = Lighting:WaitForChild('Blur')
script.Parent.MouseButton1Click:Connect(function()
for i = 3,30 do
Blur.Size = Blur.Size + (i/20)
wait()
end
end)
Don’t use Blur.Size
Get the blur object but not the property of blur.