CameraOffset not working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Making camera shake using CameraOffset.
  2. What is the issue? Include screenshots / videos if possible!
    It wont make a single shake when I test it.
  3. What solutions have you tried so far?
    I looked at every solution, it still didn’t work.

My code:

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char.Humanoid

local x = math.random(-100,100)/100
local y = math.random(-100,100)/100
local z = math.random(-100,100)/100

while true do
	hum.CameraOffset = Vector3.new(x,y,z)
	wait(0.1)
end
1 Like

nothing looks wrong to me
do you get any errors?

There’s no error in Output. I dont know why

is the script a localscript and have you tried putting the script in StarterCharacterScripts

I tried, and it worked! I should’ve known. Thank you.

Your script only randomizes it once, and sets it to the same value. You need to calculate the random inside of the loop. Like this:

while true do
	local x = math.random(-100,100)/100
	local y = math.random(-100,100)/100
	local z = math.random(-100,100)/100
	
	hum.CameraOffset = Vector3.new(x,y,z)
	wait(0.1)
end
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.