How can I make the brightness parameter decrease?

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

4 Likes

Instead of = 40-1 type:
-= 1

2 Likes

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
2 Likes

Why not use TweenService instead of that?

2 Likes

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

2 Likes

I’m recommending he uses TweenService instead.

2 Likes

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

1 Like

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

1 Like

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
2 Likes

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

3 Likes

: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.

2 Likes

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.