Help with Vector3( x,y,z) defining

Hey Developers,
I have a simple question:
I am creating a Tween in the code example down below.

local Slide = ts:Create(game.Players.LocalPlayer.Character:WaitForChild("Humanoid"), CrawlInfos, {CameraOffset = Vector3.new(0, -3, 0)})

This function just changes the Camera Offset. Is it possible to just define the “-3”?
I want to reach that the vectors x and z stay the same. But it isn’t possible to do:

local Slide = ts:Create(game.Players.LocalPlayer.Character:WaitForChild("Humanoid"), CrawlInfos, {CameraOffset = Vector3.new(CameraOffset.x, -3, CameraOffset.z)})

because the CameraOffset is not defined. Any help would be appreciated!

Make a variable for the humanoid, then you can take the camera offset from the humanoid

local Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")

local Slide = ts:Create(Humanoid, CrawlInfos, {CameraOffset = Vector3.new(Humanoid.CameraOffset.X, -3, Humanoid.CameraOffset.Z)})

Vector3 are ready only meaning you can’t change one of the values and leave the other, your best move is making a variable for humanoid and then putting same camera offset for the un-changed parts.

1 Like

That worked thank you! Another question, offtopic:
im making a realistic first person and i have the problem when i change the cameraoffset (so that the player sees his body parts), the player can see through walls… any elegant ways to prevent this?
Here is a video:


Thank you for the solution again!

Hmm I guess a possibility would be to make a raycast and tween the z camera offset back (If it detects a wall)

1 Like

Oh gosh, I have no clue to how do this… I_m gonna make a new post about this or and I’m firstly gonna search trough forums. Thank you!

1 Like