Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

When enabling and unenabling sound, get get the printed outputs, but script dosent work?

in the code below, it finds a sound, and it detects weither or not its enabled. Both prints how up when I enable and unable it, but the transparency never changes.

if script.Parent.Parent.Handle.Output.FireSound.Playing == true then
	while true do
	script.Parent.Transparency = 1
	wait(0.1)
	script.Parent.Transparency = 0
	end
	print("Flashing")

else
script.Parent.Transparency = 1
print("Off")
end


2 comments

0

Comment: Everything is set up right to, yet nothing still works

0

It shouldn't even be reaching the print("Flashing") due to the while true statement.

1 answer

✓ Accepted answer

Your issue is with the way your while statement is setup. You're never waiting after the second transparency change so it's immediately running the loop again changing the transparency back. Easy fix. Just insert another wait.

while true do
	script.Parent.Transparency = 1
	wait(.1)
	script.Parent.Transparency = 0
	wait(.1)
end

This discussion is preserved as it was. New answers, comments, and votes are closed.