Hello
I would like to change a boolean value between true and false every 2 seconds.
It should be pretty straightforward but for some reason I cannot make it work:
ts = game.TweenService
local x = Instance.new("BoolValue", workspace)
x.Value = false
local info_beacon = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1, true, 0)
local goal_beacon = {Value = true}
local tweenBeacon = ts:Create(x, info_beacon, goal_beacon)
tweenBeacon:Play()
You shouldn’t use tweens for that. You should just put it in a loop like so:
--//Initialization
local x = Instance.new("BoolValue")
x.Value = false
x.Parent = workspace
--//Loops
while x and task.wait(2) do
x.Value = not x.Value
task.wait(2)
x.Value = not x.Value
end
(also don’t use the second parameter of Instance.new as it has performance issues, just set the parent last manually)