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

How do I make a button that says how many people clicked it?

Asked by 3 years ago

I'm making a game and I'm making a reload map script but I can't figure out how to make a button that says how many people clicked it. Thanks!

0
nice greatneil80 2647 — 3y
0
a button gui wise or a model wise? Retallack445 75 — 3y
0
Buttons gui User#39520 0 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

A way i found for this is you add a number value child into the text then make the text display the number value after you convert the number into text (I would have no idea what this means if i read it so here)

local NumberValue = Instance.new("NumberValue") --Create a NumberValue

NumberValue.Parent = script.Parent  --Make the parent of the newly created NumberValue the 
TextButton

script.Parent.Parent.TextButton.MouseButton1Click:Connect(function()

    script.Parent.NumberValue.Value = script.Parent.NumberValue.Value + 1 --Add 1 to the value to resemble a click

local Number = tostring(NumberValue.Value) --The NumberValue's Value being translated into text and Learn more about strings here: (https://developer.roblox.com/en-us/articles/String)

script.Parent.Text = Number --Changing the text into the values value
end)
0
Thank you so much! This is the last script for my game! User#39520 0 — 3y
0
Its no problem! Hope your game turns out nice! TeaWithMee 76 — 3y
Ad

Answer this question