Hi devs, I have a small issue. Recently I have been trying to make a shop using leaderstats. I wanted it to give an item. I used a remote event to give the item to the person but i noticed that all cloned items in the backpack dont work after they are given, how do I fix this? Ill send the scripts:
--Local Script
local Periastron = script.Parent
Periastron.MouseButton1Click:Connect(function()
local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")
RemoteEvent:FireServer()
end)
-- ServerScriptService
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
local leaderstats = player:WaitForChild("leaderstats")
local moneyValue = leaderstats:WaitForChild("Money")
if moneyValue.Value >= 5000 then
moneyValue.Value = moneyValue.Value - 10
-- Give the item to the player
local item = game.ReplicatedStorage.Items.ClassicPaintballGun:Clone()
item.Parent = player.Backpack
else
print("Not enough money")
end
end)