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.
You're defining Player as LocalPlayer which only works in LocalScript. You can either put this script inside a LocalScript then set up a remote event that would fire the event on the server side or you can redefine the player as the one who clicked the button