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

How do i add a toggle button on a GUI?

I've been wondering how to add a toggle button for a game I have been making as an option to turn explosions off/on for lag purposes.

1 comment

0

not a request site

1 answer

Use boolean values For example the code below. It can also be switched around

local boolean = Instance.new("BoolValue", script.Parent)
boolean.Name = "WhateverYouWantTheNameToBe"

local TextObject = --wherever the object that has a text you want to change

if boolean == true then
	TextObject.Text = "ON" --changes the text if true
else
	if boolean == false then
		TextObject.Text = "OFF" --changes the text if false
	end
end

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