I created a button with a local script in it Link: http://i.imgur.com/ogML7pR.png.
Here is the code:
-- BUY SYSTEM, CREATED BY ASWORMEDORIJAN111, FOR TEST. -- 7.4.2018. OR 4/7/2018 -- VARIABLES Enabled = script.Parent.Enabled Cost = script.Parent.SwordCost.Value ItemName = script.Parent.SwordName.Value local player = game.Players.LocalPlayer local character = player.Character local backpack = player.Backpack local points = player.leaderstats -- CODING SECTION if (Enabled == true) then -- This is code for 'Enabled' value. script.Disabled = false else script.Disabled = true end local itemf = game.Lighting local item = itemf:FindFirstChild(ItemName) function onclick() if points > Cost then item:Clone().Parent = backpack points = points - Cost end end script.Parent.MouseButton1Click:connect(onclick)
And the output is here: http://i.imgur.com/DsnG4PE.png.******** Idk where did I failed... Sorry for my bad English.
At line 32, you're attempting to compare a number with an object, which will of course, return an error stating : 'attempt to compare a number with a userdata(object or something else)'
Here's how you can resolve this problem:
if points.Value > Cost then