Hope I’m not being too annoying with how much I’m on here…
I’m making a “power surge” function in my game. When a certain value is reached, all the lights will rise in brightness and volume before a blackout. How would I tween (or use any other method) things such as the brightness property of a light or audio?
Very new to scripting, there are lots of commands I don’t even know exist. Could whoever answers please explain in more detailed steps how to work this out for future reference? Thanks a lot.
Use TweenService. https://developer.roblox.com/en-us/api-reference/class/TweenService
It can tween pretty much anything apart from bool values.
I seem to remember using it for Volume so idk if the service got updated because it says on the page that it cant tween numbers
New problem. I’ve worked out a tween for changing the brightness of the light. It doesn’t work whatsoever. Is there something wrong with this coding or is “Brightness” not even a property to be tweened?
local surge = game.Workspace:WaitForChild("Values"):WaitForChild("SURGE")
local light = script.Parent
local buzz = script.Parent.Parent.Buzz
if surge.Value >= 1000 then
local TweenService = game:GetService("TweenService")
local info = TweenInfo.new(
9,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local goals =
{
Brightness = 4;
}
local LightBloom = TweenService:Create(light, info, goals)
LightBloom:Play()
end
I thought you were using a local script because nothing was printing in the output.
It might be that the if statement isn’t even running, because the value is not high enough.
Finally realized the problem with everything. It’s the if then command itself! The tween works fine without it, but how am I supposed to only have it activate by IntValue?