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

[REPOST] Morphing works but camera doesn't follow player?

Asked by 3 years ago
Edited 3 years ago

Hi!,

I am working on a game whoops sorry an "experience"

In this "Experience" the player is supposed to click a model and swap bodies with the model they clicked on, I've succeeded in the changing bodies aspect but the camera refuses to move, I've tried changing the CFrame, the subject, but nothing works, If you were looking for my code it is below

--Vars
------------------------------------------------------------
local jerryModel = script.Parent
local jerryUnion = script.Parent.JerryUnion
local clickDetect = script.Parent.ClickDetector
local char = game.Workspace.Character
--Useful Funcs
------------------------------------------------------------
function cloneChar(character)
    character.Archivable = true
    local clone = character:clone()
    character.Archivable = false
    return clone
end

--Main Code
------------------------------------------------------------------
--Called when button is clicked
function onClicked(player)
    local ogchar = player.Character
    local clone = cloneChar(ogchar)
    clone.Parent=jerryModel
    clone:MoveTo(player.Character:FindFirstChild("HumanoidRootPart").Position + Vector3.new(0, 2, 0))
    jerryUnion:Destroy()
    player.Character = char
    local cam = workspace.CurrentCamera
    cam.CameraType = Enum.CameraType.Scriptable
    cam.CFrame = player.Character.CFrame
end

--calls onClicked when Model is touched
clickDetect.MouseClick:Connect(onClicked)

If anyone could help me I would appreciate it, I've been struggling with this for a while now

Also I reposted this since I hadn't got any answers for about 3-4 days :)

Also Here's a video link

https://gyazo.com/2be5ef3dede1f2c8434094e6faa333c1

0
If you were wondering the character moves, but the camera wont follow ayuu1234 0 — 3y
0
And yes I have used Camera.CameraSubject ayuu1234 0 — 3y
0
You're setting the CameraType to Scriptable you have to set it to Custom GetGlobals 343 — 3y
0
I just tried that (Enum.CameraType.Custom) and it didnt work if you want ill send a video ayuu1234 0 — 3y
View all comments (5 more)
0
You are setting Camera.CameraSubject to the Humanoid right? GetGlobals 343 — 3y
0
Yes ayuu1234 0 — 3y
0
Lemme send a video link in the Question ayuu1234 0 — 3y
0
Have you tried listening to Rock music? DiamondComplex 285 — 3y
0
@DiamondComplex No but thank you for enlightening me ayuu1234 0 — 3y

1 answer

Log in to vote
0
Answered by
rabbi99 714 Moderation Voter
3 years ago
Edited 3 years ago

Make sure to keep your CameraType as Custom and set the Subject to the morph's Humanoid.

0
That didn't work ayuu1234 0 — 3y
0
I sent a video link in the question ayuu1234 0 — 3y
Ad

Answer this question