June 12, 2022, 5:18pm
I need help making the HumanoidRootPart follow camera.
I’ve tried a mouse following script from one of my older games and replaced it with camera and it sorta worked but I was facing backwards. This is what I tried :
local root = script.Parent.HumanoidRootPart
local cam = game.Workspace.CurrentCamera
root.CFrame = CFrame.new(root.Position, Vector3.new(cam.CFrame.X, root.Position.Y, cam.CFrame.Z))
June 12, 2022, 5:25pm
Just use the camera’s
June 12, 2022, 5:31pm
how should I implement that into my script?
June 12, 2022, 5:33pm
root.CFrame = CFrame.new(camera.CFrame.Position)
June 12, 2022, 5:34pm
that doesn’t work, that would just tp me to where the camera is infinitely
June 12, 2022, 5:35pm
Well then you need to be more specific with your description. I can’t read your mind. You’ve added very minimal data, plus you said you want the HRP to follow the camera. So you must’ve stated your question wrong.
June 12, 2022, 5:36pm
is your script meant for R15 or R6? And do you want the entire body to rotate to the camera or just the upper body?
June 12, 2022, 5:37pm
R6, and I’m talking about the entire body
June 12, 2022, 5:39pm
I’m guessing you want the entire player to be visible. For this, you would need to offset the camera. I don’t exactly know what type of camera you are looking for, but Roblox has a top-down camera example here that might be helpful:
June 12, 2022, 5:41pm
That’s not what I’m talking about.
I’m talking about the character rotating along with the camera.
Like an over-the-shoulder camera, but without the camera offset.
Anime Battle Arena’s camera is a good example of what I’m trying to do.
June 12, 2022, 5:47pm
I found this over the shoulder camera system by
What is it
This module will help you set up a smooth and customizable over-the-shoulder camera system, which is quite popular in video games. You don’t need to know how to script to set this up, however, it also allows considerable customization for those who do know how to script. You can grab the ROBLOX model from here or read the source on GitHub from here. You can also test the basic system out at this place.
How to use it?
Getting started is very easy. Just insert the module script wher…
This makes it easy to get the effect you want without having to code a bunch of stuff like offsets yourself. You can tweak the values and stuff too from the looks of it.
June 12, 2022, 5:49pm
Yeah I know but I’m really trying to avoid using any modules for my game
June 12, 2022, 5:52pm
local rootPart = Character:FindFirstChild(“HumanoidRootPart”)
local rx, ry, rz = Camera.CFrame:ToOrientation()
rootPart.CFrame = CFrame.new(rootPart.CFrame.p) * CFrame.fromOrientation(0, ry, 0)
June 12, 2022, 5:59pm
many many many thanks from me!