math.randomseed(tick())
local runService = game:GetService("RunService")
local char = script.Parent
local hum = char:WaitForChild("Humanoid")
local shaking = script:WaitForChild("Value").Value
local nextFire = 1
--
local shakeRate = 0
local shakeMin = 0
local shakeMax = shaking
runService.RenderStepped:Connect(function()
if elapsedTime() > nextFire then
nextFire = elapsedTime() + shakeRate
hum.CameraOffset = Vector3.new(math.random(shakeMin, shakeMax)/1000, math.random(shakeMin, shakeMax)/1000, math.random(shakeMin, shakeMax)/1000)
end
end)
As you can see in the code, I connected the variable called “shakeMax” with the child of script, a number value.
This script shakes the camera all the time if shakeMax is bigger than 0.
I changed the value to 0 and tested it, camera doesn’t shake. Code works
then
I changed the value to 200 and tested it, camera shakes. Code works again
BUT
When the value is 0 and I change the value to 200, camera doesn’t shake
So the problem is, code doesn’t update with the value.
Please help