Log in to vote

why this is NextInteger Returning nill ?

Asked by 17 days ago

Can someone help me out? a Random.NextInteger function is returning nill everytime i run it

the function returning the nill

local Tables = GetTablesFromAttackAnimation1(AttackFrameModule, (CanBackstab and AttackFrameModule.BackstabAnimation) and "BackstabAnimationTable" or RealType, AttackNumber)
                local Table = Tables[, #Tables)]
                LastComboDelay = Table[3][2]

the function itself

local function GetTablesFromAttackAnimation1(AttackFrameModule, AttackType, Attack)
    local Tables = {}
    for _, v in pairs(AttackFrameModule[AttackType]) do
        if v.AttackType == Attack then
            table.insert(Tables, {v.Id, v.Speed,
                {v.AttackDelay, v.ComboDelay, v.HitboxTimes, v.RaycastHitboxInstances},
                {v.DashDelay, v.DashVelocity, v.DashLifeTime},
                {v.Hitbox.HitboxType, v.Hitbox.HitboxShape, v.Hitbox.HitboxSize, v.Hitbox.HitboxCFrame, v.Hitbox.MaxPartsInRegion}})

    return Tables

the table

            Id = "rbxassetid://9518474867", Speed = 1, AttackDelay = 0.6, ComboDelay = 0.6, HitboxTimes = {0, 0.5}, RaycastHitboxInstances = {{"Tool", "Handle"}}, DashDelay = 0, DashVelocity = 1, DashLifeTime = 2, AttackType = "1",

                Hitbox = {
                    HitboxType = "RaycastHitbox",
                    HitboxShape = Enum.PartType.Block,
                    HitboxSize =, 4, 7),
                    HitboxCFrame =, 1, -2),
                    MaxPartsInRegion = 50,

1 answer

Log in to vote
Answered by 17 days ago

Hello :D, I got to say you got very interesting way of passing arguments, and maybe this is the source of problem, I am not sure at all how and works in passing arguments. When you have or it takes the first parameter, and if its true it continues without checking second one, there is example:

local humanoid = player.Character:FindFirstChild("Humanoid") or player.Character:WaitForChild("Humanoid")

If humanoid is not present first will return nil which means it will do the second one, wait for it. I dont know about and character uses at all. Change this parameters, try to erase all and and make sure you use or only for purpose I just showed you. I am sorry I cannot rewrite the code my self, because I dont understand what you want to really pass. I hope this will help you fix the problem, good luck, and I hope you will have nice rest of day.

Not the cause of the error, i have a function without the "and, "or" and it gives me the same error notasfeia 1 — 17d

Answer this question