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.
COMMUNITY QUESTION
How do i add a toggle button on a GUI?
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.

1 comment
not a request site