-- Server Script: ServerShop local ReplicatedStorage =…
- User
-- Server Script: ServerShop
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Players = game:GetService("Players")
-- Require SkiraManager module to access Skira currency local SkiraManager = require(game.ServerScriptService.SkiraManager)
-- Configuration local SPAWN_POSITION = Vector3.new(-15, 19, -63) local CURRENCY_NAME = "Skira"
-- Remote Events and Functions (related to purchasing) local PurchaseItemEvent = ReplicatedStorage:FindFirstChild("PurchaseItem") if not PurchaseItemEvent then PurchaseItemEvent = Instance.new("RemoteEvent") PurchaseItemEvent.Name = "PurchaseItem" PurchaseItemEvent.Parent = ReplicatedStorage end
local PurchaseFeedbackEvent = ReplicatedStorage:FindFirstChild("PurchaseFeedback") if not PurchaseFeedbackEvent then PurchaseFeedbackEvent = Instance.new("RemoteEvent") PurchaseFeedbackEvent.Name = "PurchaseFeedback" PurchaseFeedbackEvent.Parent = ReplicatedStorage end
local GetShopItemsFunction = ReplicatedStorage:FindFirstChild("GetShopItems") if not GetShopItemsFunction then GetShopItemsFunction = Instance.new("RemoteFunction") GetShopItemsFunction.Name = "GetShopItems" GetShopItemsFunction.Parent = ReplicatedStorage end
local IsLimitedItemAvailableFunction = ReplicatedStorage:FindFirstChild("IsLimitedItemAvailable") if not IsLimitedItemAvailableFunction then IsLimitedItemAvailableFunction = Instance.new("RemoteFunction") IsLimitedItemAvailableFunction.Name = "IsLimitedItemAvailable" IsLimitedItemAvailableFunction.Parent = ReplicatedStorage end
local LimitedItemStatusChangedEvent = ReplicatedStorage:FindFirstChild("LimitedItemStatusChanged") if not LimitedItemStatusChangedEvent then LimitedItemStatusChangedEvent = Instance.new("RemoteEvent") LimitedItemStatusChangedEvent.Name = "LimitedItemStatusChanged" LimitedItemStatusChangedEvent.Parent = ReplicatedStorage end
-- Shop items configuration local ShopItems = { { Name = "Blahaj", Description = "Best, softest, cutest, squishy toy!", Price = 35, Limited = false, New = false }, { Name = "Antler", Description = "Stolen antler that an employee stole after hitting a person", Price = 75, Limited = false, New = false }, { Name = "Dynamite", Description = "An explosive stick filled with explosive powder.", Price = 15, Limited = false, New = true }, { Name = "ECO Bricks Package", Description = "Eco Bricks for your needs!", Price = 5, Limited = false, New = false }, { Name = "Glaggle ball", Description = "If the earth is round, how come the ball ain't even going nowhere?", Price = 18, Limited = false, New = false }, { Name = "Mannequin", Description = "Has feelings, do not hurt", Price = 18, Limited = false, New = false }, { Name = "Maxwell", Description = "Found this random cat on the road, decided to name it Maxwell", Price = 18, Limited = true, New = false, Stock = 1 -- Initial stock for limited item }, }
-- Table to keep track of limited item stocks local LimitedItemStocks = {}
-- Initialize limited item stocks local function initializeLimitedItemStocks() for _, item in ipairs(ShopItems) do if item.Limited then LimitedItemStocks[item.Name] = item.Stock or 1 end end end
- Assistant