Hey i’m trying to script a nuke here and I want the flash to happen but whenever I respawn It will set the flash back to transparency 1 is there a way to prevent this from happening or do I just need some changes in the code.
local replicatedStorage = game:GetService(“ReplicatedStorage”)
local flash = replicatedStorage:WaitForChild(“Flash”)
local frame = script.Parent.Frame
local counter = 0
local counter2 = 0
local counter3 = 0
local function flashBangDisable()
while true do
print(counter3)
frame.BackgroundTransparency = frame.BackgroundTransparency + 0.1
counter3 = counter3 + 1
wait(0.05)
if counter3 > 9 then
break
end
end
end
local function enableFrame()
while true do
print(counter2)
frame.BackgroundTransparency = 0
wait(0.5)
counter2 = counter2 + 1
if counter2 > 19 then
flashBangDisable()
break
end
end
end
local function flashBang()
while true do
print(counter)
frame.BackgroundTransparency = frame.BackgroundTransparency - 0.1
counter = counter + 1
wait(0.05)
if frame.BackgroundTransparency < 0.2 then
enableFrame()
end
if counter > 9 then
break
end
end
end