#how do I button that changes a text label on a board when pressed

59 messages · Page 1 of 1 (latest)

viral fjord
#

what are you trying to change the text to

lofty kernel
#
script.Parent.MouseButton1Up:Connect(function()
    script.Parent.Text = "Clicked!"
end)
#

LocalScript parented to your Text Button

viral fjord
#

so you want it to be random or

#

alright so

#

put a script into the button and a click detector

#

Now create a table for all the possible messages

#

local messages = {
“hello”,
“bye”
}

#

replace hello and bye with your messages

#

make sure to add commas

#

add a comma in the previous one, then write a new one

#

“hello”,
“bye”,
“good morning”,
“good night”,

#

alright so

#

make a variable for your text

lofty kernel
#
local text = {
    "Clicked1",
    "Clicked2"
}

script.Parent.MouseButton1Up:Connect(function()
    local randomtext = text[math.random(1,#text)]
    script.Parent.Text = randomtext
end)

parent to your textbutton

viral fjord
#

where is the script parented

lofty kernel
viral fjord
#

alright so

lofty kernel
#

this is what my button looks like in explorer

#

ah ok

#

lemme document it

viral fjord
#

local textlabel = script.Parent

lofty kernel
#
local text = { -- Table of strings, all should contain a comma at the end except for the last one
    "Clicked1",
    "Clicked2"
}

script.Parent.MouseButton1Up:Connect(function() -- Fired when you left click the button
    local randomtext = text[math.random(1,#text)] -- Selects a random string from your text table
    script.Parent.Text = randomtext -- Sets the text
end)
viral fjord
#

uhh sure give me a second to write it in on my phone

lofty kernel
#

this is the rbxm

viral fjord
#

alr there you go

lofty kernel
#

ooh creepy size

viral fjord
#

thanks zxro

lofty kernel
#

yw

#

🤨

#

that's pretty complicated

#

yo

viral fjord
#

💀💀💀💀💀

lofty kernel
#

just steal it from the toolbox

viral fjord
#

😭😭

lofty kernel
#

and make sure it has no viruses

viral fjord
#

when I get on my pc I will show you how

lofty kernel
#

The text, right now Button will change into Clicked1 or Clicked2

#

if you spam click it you will see how it sort of "rotates" through each string

#

plates?

#

like 20 more buttons

#

i mean its not that hard

#

what the fuck

#

what kind of game

#

are you making

#

its implying that you pickedi t

latent oliveBOT
#

studio** You are now Level 8! **studio

lofty kernel
#

oh my god

#

sure

#

alr

#

man are you tryna ban me

#

im just gonna act like i lost this forum post 👍

viral fjord