function Cashier:ScanItem(item) self.totalBill = self.totalBill + item.price self.itemsScanned = self.itemsScanned + 1 game.ReplicatedStorage.Events.UpdateBill:FireAllClients(self.totalBill)
function Cashier:ProcessPayment() if self.currentCustomer.money >= self.totalBill then self.currentCustomer.money = self.currentCustomer.money - self.totalBill game.ReplicatedStorage.Events.AddMoney:FireServer(self.totalBill) self:CompleteTransaction() else print("Customer cannot afford – leaving angry") self.currentCustomer.happiness = 0 self.currentCustomer:LeaveStore() end end
| Function Name | Parameters | Description | |---|---|---| | AddDailyIncome(amount) | Money earned | Updates bank balance. | | PayDailyExpenses() | None | Deducts rent, salaries, electricity. | | UpgradeCashierSpeed(cost) | Upgrade cost | Reduces scan time per item. | | UnlockNewProduct(productID, cost) | Product ID, cost | Adds new item to supplier list. | | ExpandStoreArea(areaID, cost) | Area ID, cost | Unlocks new shelves and floor space. | | GetDailyReport() | None | Shows profit/loss, customer count, top selling item. |
Purpose: Spawns, navigates, decides purchases, and reacts to prices.
| Upgrade | Level 1 | Level 2 | Level 3 | |---|---|---|---| | Scan Speed | 2.0 sec/item | 1.5 sec/item | 1.0 sec/item | | Customer Patience | 30 sec | 45 sec | 60 sec | | Shelf Capacity | 10 units | 15 units | 20 units | Module E: UI & Player Feedback Purpose: Displays information and handles player interaction.
function Cashier:CompleteTransaction() -- Spawn next in queue self.currentCustomer = nil self.totalBill = 0 end