I wanted to make a shop where players get an item and the money gets removed from leaderstats.
The items are located on replicated storage, after i buy i receive the ittem but it doesnt work. I already tried with multiple items and all have the same issue. When I put them on startwerplayer they work but they dont on replicated storage.
How do I fix this?
-- Function to handle the purchase button click local function PeriastronClicked() local player = game.Players.LocalPlayer -- Get the player's leaderstats local leaderstats = player:WaitForChild("leaderstats") -- Get the player's money value local moneyValue = leaderstats:WaitForChild("Money") -- Check if the player has enough money to make the purchase if moneyValue.Value >= 5000 then -- Adjust the price of the item here -- Subtract the item price from the player's money moneyValue.Value = moneyValue.Value - 10 -- Adjust the price of the item here -- Give the item to the player local item = game.ReplicatedStorage.Items.PoseidonsQuakeTrident:Clone()-- item item.Parent = player.Backpack else -- Player doesn't have enough money, display an error message or take appropriate action print("Not enough money to purchase the item!") end end -- button name local Periastron = script.Parent -- Reference to the button itself -- Connect the button click event to the purchaseButtonClicked function Periastron.Activated:Connect(PeriastronClicked)