Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Local Script won't read the workspace?

So basically I made a cutscene script that is supposed to work. I always get this error: "PartA is not valid member of Model". PartA is member of that model but still, it doesn't work. Anyone know why?

wait(1)
local TweenService = game:GetService("TweenService")
local Camera = game.Workspace.CurrentCamera

local function MoveCamera(StartPart, EndPart, Duration, EasingStyle, EasingDirection)
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CFrame = StartPart.CFrame
	local Cutscene = TweenService:Create(Camera, TweenInfo.new(Duration, EasingStyle, EasingDirection), {CFrame = EndPart.CFrame})
	Cutscene:Play()
	wait(Duration)
end

local function Cutscene()
	MoveCamera(game.Workspace.CutScene.PartA, game.Workspace.CutScene.PartB, 1.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
	
	wait(.5)
	Camera.CameraType = Enum.CameraType.Custom
	Camera.CameraSubject = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
end

Cutscene()

2 comments

0

Make sure that you name the Part right.

0

Oh right I forgot, you should use WaitForChild() . Because maybe the PartA isn't replicate to the client yet. https://developer.roblox.com/en-us/api-reference/function/Instance/WaitForChild

1 answer

It seems like a temporary problem, I ran it again and it worked.

This discussion is preserved as it was. New answers, comments, and votes are closed.