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

LocalScript to change CameraSubject not working right, what is wrong???

Asked by 5 years ago
Edited 5 years ago

In my game, I need the camera to focus on the morph instead of the HumanoidRootPart. When my local script for the camera runs, the camera just stays in place. What is going on?? LocalScript:

local player = game.Players.LocalPlayer
local character = player.Character

game.ReplicatedStorage.Status.Changed:Connect(function(newstring)
    if newstring == "Game in progress." then
        wait()

        workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
        workspace.CurrentCamera.CameraSubject = character:FindFirstChild("Morph")

    end
end)
0
use workspace.CurrentCamera ForeverBrown 356 — 5y
0
0 what is Status? A string object? Delete the line that changes your camera to custom royaltoe 5144 — 5y
0
is "Morph" a model or part? ImperiumDomini2 39 — 5y
0
Model NickIsANuke 217 — 5y
View all comments (7 more)
0
But it doesn't error NickIsANuke 217 — 5y
0
I also tried manually setting the camera subject and it orked NickIsANuke 217 — 5y
0
You cant focus the camera on a model, it needs to be a part. ImperiumDomini2 39 — 5y
0
*worked* NickIsANuke 217 — 5y
0
Yes, you can. So, it worked fine and set the subject, but the camera just hovered there. I think its because the type is still scriptable??? NickIsANuke 217 — 5y
0
make the model have a primary part (in the properties of the model) and set the camerasubject to model.PrimaryPart royaltoe 5144 — 5y
0
Still didn't work NickIsANuke 217 — 5y

1 answer

Log in to vote
1
Answered by
royaltoe 5144 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago
local player = game.Players.LocalPlayer
local character = player.Character

game.ReplicatedStorage.Status.Changed:Connect(function(newString)
    if newString == "Game in progress." then

        --Make the camera point to the morph inside the player if we find the morph
        if(character:FindFirstChild("Morph") and character.Morph.PrimaryPart)then
            workspace.CurrentCamera.CameraSubject = character.Morph.PrimaryPart
        end

    end
end)
0
N, it works fine until that point, but when it changes the camera it glitches and makes the camera like relly far away. NickIsANuke 217 — 5y
0
do you still have the line of code that changes the camera type to Custom? royaltoe 5144 — 5y
0
No, I put my new code in the question NickIsANuke 217 — 5y
Ad

Answer this question