When I have less than 100 points, I still get smoke to my torso. I am supose to have more than 100 points..
--//Variables local player = game.Players.LocalPlayer points = player.Points --//Function script.Parent.MouseButton1Click:connect(function() if not player.Character.Torso:FindFirstChild('Smoke') then local sm = Instance.new("Smoke") sm.Size = .1 sm.Opacity = .1 sm.Parent = player.Character.Torso end if points.Value > 100 then --100 = price script.Parent.Text = "Smoke" points.Value = points.Value - 100 else script.Parent.Text = "Not enough points!" wait(2) script.Parent.Text = "Smoke: 100 Points" end end)
You also need to add a value inside the button, which stores how much points you need to buy it. Add an if statement inside the button that replaces the check. The script cannot do anything unless the check returns true. Since it might be hard to understand, I will fix it for you:
--//Variables local player = game.Players.LocalPlayer local points = player.Points local price = script.Parent.PriceValue --//Function script.Parent.MouseButton1Click:connect(function() if not player.Character.Torso:FindFirstChild('Smoke') then if points.Value >= price.Value then points.Value = points.Value - price.Value local sm = Instance.new("Smoke") sm.Size = .1 sm.Opacity = .1 sm.Parent = player.Character.Torso elseif points.Value > price.Value then script.Parent.Text = "Not enough points!" script.Parent.Selectable = false wait(2) script.Parent.Selectable = true script.Parent.Text = "Smoke: 100 Points" end end end)