The script is part of a gui to buy something called bonds. I'm having a problem with (input which is script.Parent.Text) and (output which is script.Parent.Parent.HowManyResult.Text). when I put in a number in the script.Parent.Text, the number goes to script.Parent.Parent.InputVal.Value which is multiplied by bondprice to get the cost of however many bonds you want. However many bonds you want are only limited by the maximum amount of bonds which makes the maximum price. The bondprice.Value is 7. the output is supposed to be the bondprice.Value times the script.Parent.Parent.InputVal.Value and the problem is that the output isn't the input value * 7. If I wanted 1 bond the output would be 0 and it's supposed to be 7, that's the problem. Can someone help me, thank you. The script is below.
--// Edited for code block. In the future please be sure to enclose your code between two lines of tildes (~), which can be inserted by clicking the blue button under the title of the question editor.
local theinput = script.Parent.Parent.InputVal
local player = game.Players.LocalPlayer
script.Parent.Changed:connect(function()
local bondprice = game.Lighting.Bank.Price.BondPrice
local maximumshares = math.floor(player.PlayerMoney.Value/bondprice.Value)
local maximumprice = math.floor(maximumshares*bondprice.Value)
local n = tonumber(script.Parent.Text)
if (not n) then return end
if theinput.Value > maximumshares then
script.Parent.Parent.HowManyResult.Text = "$" .. maximumprice
elseif theinput.Value < maximumshares then
script.Parent.Parent.HowManyResult.Text = "$" .. theinput.Value * bondprice.Value
end
end)
while wait(0.01) do
theinput.Value = script.Parent.Text
end

1 comment
Please put your code in a code block so it is easier for us to read.