Hello, I need help for my Stat point system, and I’ve been trying other ways but still no gain. I will appreciate your help!
What I need is to stop the Negative numbers and just Whole numbers.
Issue:
The numbers keep decreasing below 0 and when the stats get to negative it gives your stat points in exchange.
here’s the code:
local StatPointEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvents"):WaitForChild("StatPointEvent")
local player = game:GetService("Players").LocalPlayer
local textBox = script.Parent.PNumberValue
local StatPoints = player:WaitForChild("PStats"):WaitForChild("StatPoints")
local PointValue = textBox:WaitForChild("PointValue")
local Stat
local AddFrame = script.Parent.AddFrame
local StrengthA = AddFrame:WaitForChild("StrengthA")
local StaminaA = AddFrame:WaitForChild("StaminaA")
local EnduranceA = AddFrame:WaitForChild("EnduranceA")
local IntA = AddFrame:WaitForChild("IntA")
local WeaponA = AddFrame:WaitForChild("WeaponA")
local function onFocusLost(enterPressed, inputObject)
if enterPressed then
local TextInside = textBox.Text
StatPointEvent:FireServer("AddText", TextInside)
end
end
textBox.FocusLost:Connect(onFocusLost)
local function AddPoint1()
if player then
if PointValue.Value > StatPoints.Value then return end
if PointValue.Value == 0 then return end
StatPointEvent:FireServer("AddPoints1", PointValue.Value)
end
end
local function AddPoint2()
if player then
if PointValue.Value > StatPoints.Value then return end
if PointValue.Value == 0 then return end
StatPointEvent:FireServer("AddPoints2", PointValue.Value)
end
end
local function AddPoint3()
if player then
if PointValue.Value > StatPoints.Value then return end
if PointValue.Value == 0 then return end
StatPointEvent:FireServer("AddPoints3", PointValue.Value)
end
end
local function AddPoint4()
if player then
if PointValue.Value > StatPoints.Value then return end
if PointValue.Value == 0 then return end
StatPointEvent:FireServer("AddPoints4", PointValue.Value)
end
end
local function AddPoint5()
if player then
if PointValue.Value > StatPoints.Value then return end
if PointValue.Value == 0 then return end
StatPointEvent:FireServer("AddPoints5", PointValue.Value)
end
end
I looked everywhere but I still failed.