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

Script not working because of unknown global?

Asked by 5 years ago

Hello So I have a game with guns but it gives me an error in the main script of the game. It is an unknown global error.

elseif itemSelect and itemSelect:findFirstChild("light") and (not aiming or (not itemSelect:findFirstChild("itemHeat Scope") and not itemSelect:findFirstChild("itemNight Scope"))) then
                if itemSelect.light.Transparency == 0.75 then
                    ambient = Color3.new(150/255, 150/255, 100/255);

Aiming is the part where it gives the error I will show all of the other parts where aiming is inside.

function equipItem(name)
    if not using and not vehicle then
        GUI.gameData.aiming.Value = false;
        inMap = false;
        zoom = false;
function dropAllItems()
    GUI.gameData.aiming.Value = false;
    inMap = false;
    zoom = false;
    user.developerObject[GUI.gameData.backpack.Value]:Destroy();
if x ~= -1 then
        GUI.gameData.aiming.Value = false;
        local count = 1;
if itemSelect then
        if itemSelect:findFirstChild("itemRangefinder") and GUI.gameData.aiming.Value then
            GUI.range.Text = tostring(math.ceil((GUI.gameData.mouse.Value-cam.Focus.p).magnitude/6)).."m";
            GUI.range.Visible = true;
        else
            GUI.range.Visible = false;
        end     
if not GUI.gameData.settingHUD.Value or GUI.gameData.aiming.Value then
        GUI.left.Visible = false;
        GUI.right.Visible = false;
        GUI.top.Visible = false;        
        GUI.bottom.Visible = false;
    else
if not using and (cam.CoordinateFrame.p-cam.Focus.p).magnitude < 1 and not GUI.gameData.transporting.Value and not GUI.gameData.safezone.Value and not GUI.gameData.climbing.Value and not GUI.gameData.swimming.Value and itemSelect ~= nil and (itemType == "pistol" or itemType == "shotgun" or itemType == "automatic" or itemType == "rifle") then
        if GUI.gameData.settingAim.Value then
            if GUI.gameData.rmb.Value or GUI.gameData.key118.Value then
                GUI.gameData.aiming.Value = true;
            else
                GUI.gameData.aiming.Value = false;
            end
        else
            if GUI.gameData.rmb.Value or GUI.gameData.key118.Value then
                GUI.gameData.rmb.Value = false;
                GUI.gameData.key118.Value = false;

                GUI.gameData.aiming.Value = not GUI.gameData.aiming.Value;
            end
        end
    else
        GUI.gameData.aiming.Value = false;
    end

    if GUI.gameData.aiming.Value then
        local look = user.developerObject.fakeTorso.CFrame:toObjectSpace(CFrame.new(cam.CoordinateFrame.p, GUI.gameData.mouse.Value));
        local leftArm, rightArm;
            leftArm = _G.intendedLeftArm:toObjectSpace(look)*CFrame.new(0, -1, 0)*CFrame.Angles(math.rad(90), 0, 0)*CFrame.new(0, -0.5, 0);
            rightArm = _G.intendedRightArm:toObjectSpace(look)*CFrame.new(0, -1, 0)*CFrame.Angles(math.rad(90), 0, 0)*CFrame.new(0, -0.5, 0);

elseif GUI.gameData.aiming.Value then
        user.Humanoid.WalkSpeed = 5;
    elseif GUI.gameData.crouch.Value then
        user.Humanoid.WalkSpeed = 6;

Answer this question