I have the following script
local price = 10 --change the price of the item here
local item = game.ReplicatedStorage.Gears["SpeedCoil"] -- change this to the name of the gear in replicated Storage
script.Parent.MouseButton1Click:connect(function(player)
local x = game.Players.LocalPlayer.leaderstats.Coins.Value
local player = game.Players.LocalPlayer
local backpack = player.Backpack
print(x)
x = x-price
item:Clone().Parent = backpack
end)
There is a Button in StaterGui. Whenever a player clicks it this code is run. This is supposed to give the player the gear, which it does, but only that player can see it, and it doesn't work. I understand this has something to do with the gear being given from a localscript instead of a serverscript, but I don't know how to get the message that a gear needs to be added to the player to a serverscript, when a local script can't access anything else.
Is this even possible, and am I understanding this correctly? Any help would be appreciated.
