Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is the CFrame not changing?

Asked by 5 years ago
--[ Var ]--
local Camera = workspace.CurrentCamera 
local Players = game:GetService("Players")
local GameFolder = game.Workspace:WaitForChild("Game")
local CamParts = GameFolder.CamParts.IntroCamParts
--[ Main Code ]--

local function IntroOnPlayerJoin()
    Camera.CameraType = ("Scriptable")
    Camera.CFrame = CamParts.IntroCamPart1.CFrame
    wait(5)
    Camera.CameraType = ("Scriptable")
    Camera.CFrame = CamParts.IntroCamPart2.CFrame
end

Players.PlayerAdded:Connect(IntroOnPlayerJoin)

Why no work, i dont know, do you? local script in replicated first.

thanks for reading, Narwhal

0
Use a LocalScript and use CurrentCamera and not Camera. NiniBlackJackQc 1562 — 5y
0
i am using a local script and i am using current camera. NarwhalAndMe 141 — 5y

1 answer

Log in to vote
0
Answered by
Benbebop 1049 Moderation Voter
5 years ago
Edited 5 years ago

When you change a parts position you need to use CFrame.new instead of just CFrame

--[ Var ]--
local Camera = workspace.CurrentCamera 
local Players = game:GetService("Players")
local GameFolder = game.Workspace:WaitForChild("Game")
local CamParts = GameFolder.CamParts.IntroCamParts
--[ Main Code ]--

local function IntroOnPlayerJoin()
    Camera.CameraType = ("Scriptable")
    Camera.position = CFrame.new(CamParts.IntroCamPart1.position)
    wait(5)
    Camera.CameraType = ("Scriptable")
    Camera.position = CFrame.new(CamParts.IntroCamPart2.position)
end

Players.PlayerAdded:Connect(IntroOnPlayerJoin)
Ad

Answer this question