My script only works in play solo, when I play on the server it doesn't work this is the script
script.Parent.MouseButton1Click:connect(function()
local RS = game:GetService("ReplicatedStorage")
local item = RS:WaitForChild("LinkedSword")
local price = 50
local Player = game.Players.LocalPlayer
local stats = Player:WaitForChild("leaderstats")
if stats.Coins.Value>= price then
stats.Coins.Value=stats.Coins.Value - price
local cloned=item:Clone()
local cloned2=item:Clone()
cloned2.Parent=Player.Backpack
cloned.Parent=Player.StarterGear
end
end)
Here's a link to a screen shot of the errors.
Hope you can help.

2 comments
I'm quite new to scripting so can you give me an example of redefining the player as the one who clicked the button?
aye thats what i wanted to say