Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i add a toggle button on a GUI? [closed]

Asked by 4 years ago

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.

0
not a request site raid6n 2196 — 4y

Closed as Not Constructive by botw_legend, raid6n, and EzraNehemiah_TF2

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
LaysCo 61
4 years ago
Edited 4 years ago

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
Ad