PLR = game.Players:GetChildren(game.Workspace.GREEN.PLRNAME.Value) > function onClicked() > if PLR.leaderstats.Money.Value >49 then game.Lighting.oldmachinegreensmall.Parent = game.Workspace end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
then it gives an error:
Workspace.Sign.Text.Script:10: attempt to index field 'leaderstats' (a nil value)
For first, remove the >
, and on click you can get player
And the :connect
is deprecated, use :Connect
--Server Script(Script) -- You dont need to use game.Workspace, you can use workspace function onClicked(plr) -- On click get player if plr.leaderstats.Money.Value >= 50 then -- Changed > 49 to >= 50 / Detect money game.Lighting.oldmachinegreensmall.Parent = workspace -- Clone item and put on Workspace -- You can storage the item in ServerStorage. dont use Lighting for this. end end script.Parent.ClickDetector.MouseClick:Connect(onClicked) -- On click start function, with sending the player
Wiki pages:
Hope it helped :)
Errors? tell-me on comments.