You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Trying to make floor lasers use tween service
What is the issue? The lights don’t fade smoothly.
What solutions have you tried so far?
– Code doesn’t use tweenservice
local pointlight = script.Parent
local open = game.ServerStorage.Robberys.Configuration[“Bank IsOpen”].Value
local AlarmIsActive = workspace.Bank.Vault.Vault.Configurations.AlarmIsActive.Value
function FadeOn()
for i = 0,10,0.5 do
pointlight.Brightness = i
wait(0.01)
end
end
function FadeOff()
for i = 10,0,-0.5 do
pointlight.Brightness = i
wait(0.01)
end
end
while wait(0.01) do
FadeOn()
repeat wait() until pointlight.Brightness == 10
FadeOff(0.01)
repeat wait() until pointlight.Brightness == 0
Hi, it’s your script with tween service. (In full)
local TweenService = game:GetService("TweenService")--Get tween service
local pointlight = script.Parent
--Set tween duration
local tweenInfo = TweenInfo.new(1)
--Set goal for fist tween with a dictionary
local goal = {}
goal.Brightness = 10
--Create first tween
local tweenFadeOn = TweenService:Create(pointlight, tweenInfo, goal)
--Set goal for second tween with a dictionary
goal.Brightness = 0
----Create second tween
local tweenFadeOff = TweenService:Create(pointlight, tweenInfo, goal)
while wait() do
tweenFadeOn:Play() --Play first tween
tweenFadeOn.Completed:Wait() --Wait for play end
tweenFadeOff:Play() --Play second tween
tweenFadeOff.Completed:Wait() --Wait for play end
end