Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

ServerScriptService.Game:2249: attempt to perform arithmetic (div) on nil and number?

Asked by 2 years ago

can somebody explain problem i got on 2249 code (marked it)

                                    local divide = 1
                if hum.Parent:FindFirstChild("IsArmor") then
                    divide = 3
                elseif hum:FindFirstChild("IsJugg") then
                    divide = 7
                end                  
--2249--            if hum.Health > Config.damage / divide * 2 then
                hum:TakeDamage(Config.damage / divide)
                else
                    if hum.Parent:FindFirstChild("HumanoidRootPart") then 
                        if not ReplicatedStorage:WaitForChild("CharStats"):FindFirstChild(hum.Parent.Name).Downed.Value then
                            if Players:GetPlayerFromCharacter(hum.Parent) then
                                ReplicatedStorage:WaitForChild("Events"):WaitForChild("FT"):FireClient(Players:GetPlayerFromCharacter(hit.Parent), hit, (Vector3.new(0, 2, 0) + Player.Character.HumanoidRootPart.CFrame.LookVector) * (Config.ShoveForce or 3000) / 2, 0.1, Vector3.new(5, 5, 5))
                            else
                                local v88 = Instance.new("BodyForce");
                                v88.Force = (Vector3.new(0, 1, 0) + Player.Character.HumanoidRootPart.CFrame.LookVector) * (Config.ShoveForce or 3000) / 2;
                                v88.Parent = hum.Parent.Torso;
                                game.Debris:AddItem(v88, 0.1);
                                hum.Parent.HumanoidRootPart.RotVelocity = Vector3.new(5, 5, 5)
                            end
                        end
                    end
                    if e == "HSP" then
                        hum:TakeDamage(Config.damage  / divide)
                    else
                        if ReplicatedStorage:WaitForChild("CharStats"):FindFirstChild(hum.Parent.Name) then
                            hum.Health = 1
                        end
                    end
                end 

                Flinch.Flinch(hum, hit.Name)
                local Effect = Instance.new("Part", workspace:WaitForChild("Filter"))
                Effect.Size = Vector3.new(0.1, 0.1, 0.1)
                Effect.Anchored = true
                Effect.CanCollide = false
                Effect.Position = pos
                Effect.Transparency = 1
                game:GetService("Debris"):AddItem(Effect, 2)
                ReplicatedStorage:WaitForChild("Events"):WaitForChild("BloodHitEvent"):FireAllClients(Effect)
            end
        end
    end
0
print(Config, divide) you should see that one of these numbers is nil, which one is it? imKirda 4491 — 2y
0
it's most likely the divide thing since on lines before you do: if there is hum.Parent:FindFirstChild("IsArmor") then divide is 3, else if hum:FindFirstChild("IsJugg") then divide is 7, but what if none of these are true? then divide may be nil imKirda 4491 — 2y
0
@ImKirda see line 1 nob Xapelize 2658 — 2y
0
he edited!!!!!!!!!!!!!!!!!!! imKirda 4491 — 2y

Answer this question