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)