Attempt to call a table value error

Hey!
My module, specifically the line with the comment next to it, errors “Attempt to call a table value”.
I’m not too sure as to why I’m getting this error, could anyone try and explain it to me?

Many thanks!

Module
local module = {}

local Camera = workspace.Camera
local TweenService = game:GetService("TweenService")

function module:CreateTween(Camera, Time, Part1, Part2)
	if Camera and Time and Part1 and Part2 then
		Camera.CameraType = Enum.CameraType.Scriptable
		Camera.CFrame = Part1.CFrame
		TweenService:Create(Camera, TweenInfo(Time), {CFrame = Part2.CFrame}):Play() -- THIS LINE
	end
end

return module
LocalScript that I require the Module in
local TweenCamera = require(game.ReplicatedStorage.Modules.TweenCamera)
local RemoteEvent = game.ReplicatedStorage.RemoteEvents.StartTutorial
local Camera = workspace.Camera
local Player = game.Players.LocalPlayer

RemoteEvent.OnClientEvent:Connect(function()
	Player.Character.Humanoid.WalkSpeed = 0
	Player.Character.Humanoid.JumpPower = 0
	for i,v in pairs(game.Workspace.Plots:GetDescendants()) do
		if v.Name == "PlotOwner" and v.Value == Player.Name then
			local StartTutorialPart = v.Parent.Parent:FindFirstChild("CameraParts").StartingTutorialCamera
			if StartTutorialPart then
				TweenCamera:CreateTween(Camera, 1, Player.Character.HumanoidRootPart, StartTutorialPart)
			end
		end
	end
end)
local module = {}
return module

Try replacing those to

local TweenCamera = {}
return TweenCamera

I’m not sure the variable name for the module matters? Since they’re called in seperate scripts.

This line is the issue because you can’t call the TweenInfo datatype. You must do TweenInfo.new(Time).

2 Likes

My bad, I thought it matters. I haven’t been using modules in a while.

Yeah @TheCarbyneUniverse’s right, try that.

1 Like