Trying to make a shop gui. So you click this button and if you have 50 or more points, it's supposed to give you the gear and take 50 points away (the points is like a leaderstat type value located within the player.) For some reason, no matter how many points I have, it always prints "Not enough points." Please help.
local plr = script.Parent.Parent.Parent.Parent.Parent
local price = 50
function click()
if plr.Points.Value >= price then
plr.Points.Value = plr.Points.Value - price
local clone = game:GetService("InsertService"):LoadAsset(16688968):GetChildren()[1]
clone.Handle.Anchored = false
clone.Parent = plr.Backpack
elseif plr.Points.Value < price then
print("Not enough points")
end
end
script.Parent.MouseButton1Down:connect(click)

2 comments
well I just wanted to let you know that the line "if plr.Points.Value >= price then" it's not supposed to be >=. It should just be "if plr.Points.Value > price then". The reason it's doing this is possibly because the first "if" statement doesn't work, so it goes to the "elseif" statement. Not sure, but try it out.
Also you might not have defined what plr.Points.Value is. You need to set it to a number more than 50 or something like that.