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

Is there any other way of writing this boolean code? (CODE DOES WORK BUT HELP) ?

This script is in a Local Script and it works but I just want to know if there is a better way of writing it. Maybe in a module.. no clue

--|| Edit this ||
local ShowGui = false --Change to either 'true' or 'false'.
local RemoveGui = true


--|| Don't touch, mine! ||
if ShowGui then
	script.Parent.Visible = true
elseif ShowGui == false then
	script.Parent.Visible = false
end

if RemoveGui then
	script.Parent:Remove()
elseif ShowGui == false then
	
end

1 answer

✓ Accepted answer

Just set the visibility to the variable.

Example,

local ShowGui = false --Change to either 'true' or 'false'.
local RemoveGui = true

script.Parent.Visible = ShowGui

if RemoveGui then
    script.Parent:Destroy()-- Use Destroy
elseif ShowGui == false then

end

That would simplify it a little bit.

Good Luck!

I'm not sure if this is what you wanted, but I decided to answer anyways.

1 comment

0

It will work, thanks.

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