Hi, I’m trying to make my own price input system, and I’m trying to make the decimal button.
Here’s my current code:
local this = script.Parent
local PriceNumber = this.PriceNumber
local function addnumber(input)
local convert = tostring(input)
if PriceNumber.Text == "$0.00" then
PriceNumber.Text = "$"..input
else
PriceNumber.Text = PriceNumber.Text..input
end
end
this.decimal.Button.MouseButton1Click:Connect(function()
local decimalCheck = tostring(PriceNumber.Text)
if decimalCheck:match(".") then
print("Has decimal already!")
else addnumber(".")
end
end)
No matter what, it always says there’s a decimal already. I have tried with different characters other than a decimal, and it seems to work.
I’ve looked around to see if there’s another way to index the decimal, but I came up empty handed.
If anyone could help me out I would greatly appreciate it. Thank you!