So, I have this script that looks into text boxes and then uses them as a number ofc, im having a problem where if theres nothing in the textbox, it comes out as nil and the multiplication doesnt work, and the whole script breaks. Is there any way I can just use a nil value as 0 when trying to multiply?
heres my script
`local datastoreservice = game:GetService(“DataStoreService”) – These two lines are the datastores
local bandata = datastoreservice:GetDataStore(“TimedBans”)
script.Parent.Parent.SecondFrame.Ban.OnServerEvent:Connect(function(plr,plrtoban,reason,days,hours,minutes,timemsg)
wait(0.1)
local uid = game.Players:GetUserIdFromNameAsync(plrtoban)
local ostime = os.time()
local days = tonumber(days)
local hours = tonumber(hours)
local minutes = tonumber(minutes)
local d = days * 86400
local h = hours * 3600
local m = minutes * 60
local length = d + h + m + ostime
local table2 = {uid,length,reason}
bandata:SetAsync(uid,table2)
if game.Players:FindFirstChild(plrtoban) == nil then
print(“Not in server”)
else
game.Players:FindFirstChild(plrtoban):Kick(“You have been banned\n For: “… reason …” Time “… timemsg …””)
end
if d ~= nil then
d = 0
end
if h ~= nil then
h = 0
end
if m ~= nil then
m = 0
end
end)`