Twelve days ago I asked
'My script only works in play solo, when I play on the server it doesn't work this is the script'
someone answered
'redefine the player as the one who clicked the button'
I'm new to scripting and have no idea what this means so can someone give me an example
this is the script that isn't working on the server but in play solo
script.Parent.MouseButton1Click:connect(function()
local RS = game:GetService("ReplicatedStorage")
local item = RS:WaitForChild("LinkedSword")
local price = 50
local Player = game.Players.Player
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)

3 comments
You can't use game.Players.LocalPlayer in a Server Script
game.Players.Player? What is that supposed to be?
Filipalla can you send me an example of what the script would look like if I did this?