I want the brightness of the subject to decrease by 1 for every second.
Instead of = 40-1 type:
-= 1
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.
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
Why not use TweenService
instead of that?
That is not what was necessarily asked for in this scenario.
I’m recommending he uses TweenService
instead.
Handle is not a valid member of Tool “Players.Szerpan.Backpack.Ultraviolet”
Can you show us the children of the tool?
That’s only if you want to use TweenService for reducing the brightness more smoothly, but yes.
Where have you put the tool in Studio?
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
thank you for your help. can I find out more about waitforchild somewhere?
: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.
You can find more information about TweenService
here:
Or you could watch this tutorial, which i found was helpful to me some time ago:
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.