I have been having trouble for quiet some time now on how to make a surface gui shop and tried so many ways scripting it to but the item into my players inventory but is not working.

This is the latest way i have tried to get it to work

repeat wait() Player = game.Players.LocalPlayer button = script.Parent Item = game.Lighting.SprayPaint cost = 47 Money = Player.leaderstats.Money until

function onClicked(playerWhoClicked) Workspace["Shop Part 1"].surfaceGui.Loz.TextLabel.LocalScript = cript.Parent.ClickDetector.MouseClick:connect(onClicked)

	if Money.Value > (cost - 1) then
		Money.Value = Money.Value - cost
		local a = Item:Clone()
		a.Parent = Player.Backpack
		Local b = Item:Clone()
		b.Parent = Player.StarterGear
	end

1 comment

0

I also forgot to add that i have a leaderstats