TextLaber text gui

I need a number to be added when the button is pressed and immediately displayed on the player’s gui, but I need to display the % sign there as well, but I don’t remember how to do this.

local i = 0
SP = script.Parent
_G.SCharge = 0
local number = 0
local pr = "%"

script.Parent.C4.MouseButton1Click:Connect(function()
	repeat
		wait(0.1)
		i += 0.01
		number += 1
		_G.SCharge += 1
		SP.ShockCharge.Text = tostring(number),pr
	until i >= 1
end)

If you want to display the % for the text

just do

SP.ShockCharge.Text = tostring((number/maxNumber)*100),pr

Maxnumber being the limit i.e. 10, 1 or 100 etc.

Hopefully this helped.

I’m probably not spelled correctly, but I have a problem that the % sign is not displayed along with the number on the text lab gui.

Ohh mb, just do

SP.ShockCharge.Text = tostring((number/maxNumber)*100)..pr

my mistake was that I put it before pr , but it was necessary …
Thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.