Jump to content

functions to use to get number from edit box?

Recommended Posts

Hello i'm tryna make a shop with a gridlist + editbox and a button smth like this:


So how do i get to get this work:

Ik i'll probably use guiGetText on the editbox but how do I make if in the editbox: 10, the event will trigger 10 times as well or the money needed on a single purchase would be multiplied by 10x and he will get 10x the amount of the single purchase.


Link to post
-- if you want to trigger something 10 or multiple times you can use "for" loop.

for i = 1, 10 do
	-- trigger your thingies

-- if you want to multiply something you will need to use the * operator.

local price = 1000
local amount = 10

function multiply(price, amount)
  return price * amount

print(multiply(price, amount)) -- should return 10000.
Edited by Haxardous
  • Like 1
Link to post

So let’s say your item costs 5 and in the edit box you enter 3 so all you do is 

itemPrice * guiQuantity; (in our case 5 * 3 = 15)

also you should do if the editbox is empty

guiQuantity = 1;

Edited by Tekken
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...