Log in to vote
-1

[SOLVED] Module Script experiencing an error while loading?

Asked by 7 years ago

For some reason my server-sided script cannot load this module script, however it doesn't tell me why it can't.

Explorer: http://prntscr.com/39hv3k

In the server-side script: (game.ServerStorage.Script)

local cameraModule = require(Workspace.cameraModule)

game.Players.PlayerAdded:connect(function(plr)
    print'1';
    plr.CharacterAdded:connect(function(char)
        print'2';
        cameraModule.cameraPosition(plr, char);
    end)
end)

In the module script: (game.Workspace.cameraModule)

cameraModule = {};

cameraModule.createPosition = function(plr, char)
    print'1';
    local cameraSubject = Instance.new("Part", char);
    cameraSubject.Name = "cameraSubject";
    cameraSubject.Size = Vector3.new(1,1,1);
    cameraSubject.Transparency = 1;
    cameraSubject.CFrame = CFrame.new(char.Head.Position.X - 3.25, char.Head.Position.Y, char.Head.Position.Z + 4);
    cameraSubject.Anchored = true;
    cameraSubject.CanCollide = false;
    local cameraWeld = Instance.new("Weld", cameraSubject);
    cameraWeld.Part0 = cameraSubject;
    cameraWeld.Part1 = char.Head;
    print"cameraSubject Instantiated";

    local cameraPosition = Instance.new("Part", char);
    cameraPosition.Name = "cameraPosition";
    cameraPosition.Size = Vector3.new(1,1,1);
    cameraPosition.Transparency = 1;
    cameraPosition.CFrame = CFrame.new(char.Head.Position.X - 3.5, char.Head.Position.Y + 1, char.Head.Position.Z - 5);
    cameraPosition.Anchored = true;
    cameraPosition.CanCollide = false;
    local cameraWeld2 = Instance.new("Weld", cameraPosition);
    cameraWeld2.Part0 = cameraPosition;
    cameraWeld2.Part1 = char.Head;
    print"cameraPosition Instantiated";

    Workspace.cameraCall:InvokeClient(plr);
end

cameraModule.createCamera = function()
    char = game.Players.LocalPlayer.Character;
    char:WaitForChild("cameraSubject");
    char:WaitForChild("CameraPosition");
    Workspace.CurrentCamera.CameraType = "Scriptable";
    Workspace.CurrentCamera.CameraSubject = char.cameraSubject;
    Workspace.CurrentCamera.CoordinateFrame = CFrame.new(char.cameraPosition.Position);
end

return cameraModule;

Answer this question