What i want to do is when the player has greater then or equal too (>=) points it subtracts points from the players in-game points. The thing was when the player didn't have enough money, it still subtracted it and gave them a negative number. Which i didn't want. And when i did less then or equal too (<=) when they had enough and they bought it and took away points it said they couldn't afford it when i didn't want it to.
This is my code:
(In a LocalScript)
local money = script.Parent.Parent.Parent.Parent.ShopMenu.PlayerPoints.num
local space1Avalible = script.Parent.Parent.PlanetSpotsAvalible.Ring_LVL1.Space1_Avalible
local space2Avalible = script.Parent.Parent.PlanetSpotsAvalible.Ring_LVL1.Space2_Avalible
local space3Avalible = script.Parent.Parent.PlanetSpotsAvalible.Ring_LVL1.Space3_Avalible
local space4Avalible = script.Parent.Parent.PlanetSpotsAvalible.Ring_LVL1.Space4_Avalible
local function addNewPlanetToList()
local planetListItem = game.StarterGui.PlanetGui.ListOfPlanets.Planet1:Clone()
planetListItem.Name = "Planet2"
planetListItem.Text = "Planet2"
planetListItem.Position = UDim2.new(0, 0, 0.35, 0)
end
local function getNewPlanet()
local planet1 = workspace.PlanetPlacement
local PlanetModel = Instance.new("Model")
PlanetModel.Name = "Planet2"
PlanetModel.Parent = workspace
planet1.Parent = PlanetModel
planet1.Position = workspace.PlanetPlacement2.Position
addNewPlanetToList()
print("Planet succesfully bought!")
end
script.Parent.MouseButton1Click:Connect(function()
if money.Text >= "1500" then
getNewPlanet()
money.Text = money.Text - 1500
script.Parent.Parent.Visible = false
space2Avalible.Value = false
end --Right here!
end)
idk whats wrong..can someone plz tell me..?

3 comments
Try this on line 26 'if tonumber(money.Text) >= 1500 then'.
and on line 28 try 'money.Text = tostring(tonumber(money.Text) - 1500)'
@thesit123 that worked! Thank you!