Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i get my script to work on the server? Only works on solo play.

Asked by 7 years ago

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)

0
You can't use game.Players.LocalPlayer in a Server Script Filipalla 504 — 7y
0
game.Players.Player? What is that supposed to be? Programical 653 — 7y
0
Filipalla can you send me an example of what the script would look like if I did this? bobsville2000 -7 — 7y

Answer this question