script.Parent.MouseButton1Click:connect(function()
 local RS = game:GetService("ReplicatedStorage")
 local item =  RS:WaitForChild("Golden Sword")
 local price = 150 
 local player = game.Players.LocalPlayer
 local stats = player:WaitForChild("leaderstats")
  if stats.Money.Value >= price then
  stats.Money.Value = stats.Money.Value - price
  local cloned = item:Clone()
  local cloned2 = item:Clone()
  cloned2.Parent = player.Backpack
  cloned.Parent = player.StarterGear
 end
end)


`

1.script.Parent.MouseButton1Click:connect(function() 2. local RS = game:GetService("ReplicatedStorage") 3. local item = RS:WaitForChild("Golden Sword") 4.local price = 150 5. local player = game.Players.LocalPlayer 6. local stats = player:WaitForChild("leaderstats") 7.if stats.Money.Value >= price then 8.stats.Money.Value = stats.Money.Value - price 9. local cloned = item:Clone() 10.local cloned2 = item:Clone() 11. cloned2.Parent = player.Backpack 12.cloned.Parent = player.StarterGear 13.end 14.end)

3 comments

0

This text is too messy to read. I can't even tell where line 6 is otherwise i might be able to help also could you reply with the error message?

0

Did you create leaderstats in the first place? If "leaderstats" doesn't exist, the script won't continue.

0

yes I do have a working leaderstats folder with one currency called "Money"