Camera Help - Script

Hi, I have this script, (the only script in the game (sorta))

local player = game.Players.LocalPlayer
local char = player.Character
local hrp = char:WaitForChild("HumanoidRootPart")

wait(1)

local NewCam = Instance.new("Camera")
NewCam.Parent = game:GetService("Workspace")
NewCam.CameraType = Enum.CameraType.Custom
NewCam.CameraSubject = char:WaitForChild("Humanoid")
workspace.CurrentCamera = NewCam

Ok, so, I also have a car. When I disable this script and play the game and drive around the camera doesn’t glitch out when I move the camera, but with this script enabled and I drive around the camera glitches out. Is there anything I’m missing? The camera I’m making in the script should be exaclty the same as the original camera right?
If you could help that’d be awesome.
Cheers,

3 Likes

Why are you creating a new camera? Just use the built-in one.

local player = game.Players.LocalPlayer
local char = player.Character
local hrp = char:WaitForChild("HumanoidRootPart")

wait(1)

workspace.CurrentCamera.CameraSubject = char:WaitForChild("Humanoid")
2 Likes

I’m going to script the camera but I noticed when I made a new one when the cutscene was done it wasn’t the same as the built in one

1 Like

im really confused, you really arent providing enough information
the camera isnt the thing that is doing the stuff for your character, most of that is done using scripts
a few questions i have is:
why are you creating a new camera system instead of using the built in one, because maybe there is a new solution to your problem
what is exactly in detail this “glitching”

Hi, thanks for replying. I’ve recorded my screen with my voice in the background trying to explain what my issue is here.

If you can help that’d be awesome.
Cheers,

1 Like

The problem is that the new camera you are giving it does not have collision detection, which may be because the default camera scripts aren’t kicking in.

Default camera:

New camera:

One easy way of solving this would be to enable Invisicam.
Your second option would be to disable the collision of the car at certain times on the client, causing the camera to pass through.

1 Like

Hi, so I tried Invisicam and it’s not really what I was looking for. Is there another simple fix? Cheers,

1 Like

There is a module for this, search up “camera collisions” in the toolbox. It is really helpful.

1 Like

I don’t really want things to go transparent. Is there another fix? Is there a way to access the cameras collision and set the camera to a collision group, ect.

1 Like

Yeah, I thought one of the replies here was the post, apologies. Sorry!

2 Likes

No problem. Do you happen to know any thing I can try to fix my issue?

1 Like

You could try to manipulate the normal camera and set the CameraSubject to the car. Otherwise, that’s my only fix.

2 Likes

Ok, thanks for trying. I happen to have already tried that lol. Have a great day!

2 Likes

As I’ve said in the reply, there is a second option that is probably what you are looking for.
I hope this helped.

Example code:

function onEnter(car)
       car.Seat.CanCollide = false
       car.CanCollide = false
       return
end

You can try setting the camera collision group with this

1 Like

Dude, thanks so much. Have a great day!