How can I make the brightness parameter decrease?

I want the brightness of the subject to decrease by 1 for every second.
image

Instead of = 40-1 type:
-= 1

1 Like

Also just letting you know you will have to redo that script at some point since it’s most likely gonna fail, and not do what you want it to do.

1 Like

Like this:

script.Parent.Equipped:Connect(function()
    script.Parent.Handle.equip:Play()
end)

script.Parent.Handle.UltraLight.Brightness = 40
while script.Parent.Equipped do
    script.Parent.Handle.UltraLight.Brightness -= 1
    wait(1)
end
1 Like

Why not use TweenService instead of that?

1 Like

That is not what was necessarily asked for in this scenario.

1 Like

I’m recommending he uses TweenService instead.

1 Like

Handle is not a valid member of Tool “Players.Szerpan.Backpack.Ultraviolet”

Can you show us the children of the tool?

1 Like

That’s only if you want to use TweenService for reducing the brightness more smoothly, but yes.

1 Like

image

Where have you put the tool in Studio?

1 Like

I would like to make it smoother, but I only practice for 2 days. I can’t do that

Strange. Maybe you should add :WaitForChild() instead:

local Handle = script.Parent:WaitForChild("Handle")
Handle.UltraLight.Brightness = 40

while script.Parent.Equipped do
    Handle.UltraLight.Brightness -= 1
    wait(1)
end
1 Like

thank you for your help. can I find out more about waitforchild somewhere?

1 Like

:WaitForChild() basically keeps checking the object, to wait to see it until it exists. You can find more information about it, in their official documentation: Instance | Documentation - Roblox Creator Hub.

1 Like

You can find more information about TweenService here:

Or you could watch this tutorial, which i found was helpful to me some time ago:

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.