So i want to do when the player has 1500 points, when a button is clicked it checks the amount of points the player has then it runs some code and it takes away some points as well, because you bought something and that's basically how Shop Scripts work.
I put this script in a GUI in a TextButton: (In a LocalScript)
local points = script.Parent.Parent.Parent.Parent.ShopMenu.PlayerPoints.num
script.Parent.MouseButton1Click:Connect(function()
if tostring(points.Text >= 1500) then
points.Text = tostring(tonumber(points.Text) - 1500)
workspace.PlanetPlacement.BillboardGui.Enabled = true
workspace.Planet.PlanetBall.BillboardGui.Enabled = true
workspace.PlanetPlacement2.BillboardGui.Enabled = true
workspace.PlanetPlacement3.BillboardGui.Enabled = true
end
end)
I want to do another if then statement (if tostring(points.Text) <= 1500 then for short) for when your currency is less than 1500, running code saying that your balance is low.
This is what i tried: (In a LocalScript)
local points = script.Parent.Parent.Parent.Parent.ShopMenu.PlayerPoints.num
script.Parent.MouseButton1Click:Connect(function()
-- ^ other if then statement above (not the function) --
if tostring(points.Text <= 1500) then
print("Balance Low. Needs " ..points.Text - 1500.. " more points to buy.") --This can be a TextLabel as well. wut ever if that's wrong just fix it plz! :P (and delete this comment)
script.Parent.Parent.PurchaseFailedTXT.Visible = true
end
end)
And the points GUI code: (the variable on line 1 of all of the code above [In a LocalScript])
local pointsToEarn = 35
local waitTime = 1
while wait(waitTime) do
script.Parent.Text = script.Parent.Text + pointsToEarn
end
Plx help me with my issues! Thx! ~Chez_Guy ;)

4 comments
what are you using to store the money?
Just a text label..should a make a number variable..?
Could be exploited very easily...
@hiimgoodpack the variable?