Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make camera Shake When you enter a room?

Asked by 5 years ago
Edited 5 years ago

So I'm bad at scripting And I made a camera Shake Script(For a Horror Game) But I want it to activate when I enter a room Any Help Would be Thankful Thanks! Edit: And When its activated and you step on it again it stops

math.randomseed(tick())
local runService = game:GetService("RunService")

local char = script.Parent
local hum = char:WaitForChild("Humanoid")

local nextFire = 0


local shakeRate = 0 
local shakeMin = 100
local shakeMax = 200 

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)
0
Reigion3's maybe Fad99 286 — 5y
0
Lol ~~~~~~~~~~~~~~~~~ camera.x, camera.y, camera.z CFrame = CFrame.new() * CFrame.Angles() the list goes on... ~~~~~~~~~~~~~~~~~ Robloxian_Hero1234 14 — 5y

Answer this question