Hey all!
I'm new to cameras and I'm trying to make a camera script that circles around a model when a player enters the game (and a one-time GUI). I got this error for a camera script:
16:46:04.260 - CFrame is not a valid member of Model 16:46:04.260 - Stack Begin 16:46:04.261 - Script 'Players.Player1.PlayerGui.ScreenGui.TextButton.ButtonScript', Line 17 16:46:04.261 - Stack End
Here's Line 17 (full script at the end) :
cam.CoordinateFrame = workspace.Castle.CFrame * CFrame.Angles(0,angle,0)
Castle is a model made up of 2 models (Basically 2 models grouped together)
On the Wiki, CFrame is a valid property of Model, so what is this error trying to tell me?
FULL SCRIPT
workspace:WaitForChild("Castle")
cam = workspace.CurrentCamera
rotate = true
player = game.Players.LocalPlayer
loaded = false
script.Parent.MouseButton1Click:connect(function()
if loaded then
rotate = false
cam.CameraSubject = player.Character.Humanoid
cam.CameraType = "Follow"
script.Parent.Parent:Destroy()
end
end)
cam.CameraSubject = workspace.Castle
angle = 0
while rotate do
cam.CoordinateFrame = workspace.Castle.CFrame * CFrame.Angles(0,angle,0)
angle = angle + math.rad(3)
if player.Character:FindFirstChild("Humanoid") then
loaded = true
end
wait()
end

1 comment
Thanks for that, I'll test it out and accept it as the correct answer if it works out. While I'm at it, the script up there should work right?