So I'm working on an RPG and I'm trying to make a shop GUI like in RPG World or Slaying Simulator. I am a noob at scripting so if you know the answer, please tell me what I did wrong. Script: In the out
local buyer = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect()
if buyer.leaderstats.Gold.Value >= 100 and script.Parent.MouseButton1Click:connect() then
game.ServerStorage.Folder.Sword:Clone().Parent = game.Players.LocalPlayer.Backpack
end
if buyer.leaderstats.Gold.Value <= 100 and script.Parent.MouseButton1Click:connect() then
return end

5 comments
can you include this in a code block
Alright, Done.
This needs to be moved to a server script as that is where you manage player stats. you would need to look at remote events if you have not already done so
As I said, I SUCK at scripts and i changed it to a different script, made a remote event and put it in server script service. Now it says: 16:07:33.366 - ServerScriptService.Script:4: attempt to index field 'LocalPlayer' (a nil value)
local player is not accessable by serverscript.. to define local player you have to use a local script like : game.Players.LocalPlayer