I’m DragonDarkVader A Roblox Developer with a big dreams (Including being part of Roblox RDC)
(My Plan)
I’m making the most advanced Horror game like Doors
(Something i need help with)
Anybody know how to make a system were if a monster is near you, Your camera will shake? (Like any monster whitelisted in the localscript/script/modulescript)
u can use run service.renderstepped in a local script tp handle to camera shake. Also u need to calculate the position between the monster and the player.
(playerpos - monsterpos).magnitude -- Something like this
follow the module’s example code to setup the module then on a runservice renderstepped check the distance between the character and the monster using mangitude. then if they are in a certain range shake the camera
I would recommend looking up some tutorials by alvinblox or thedevking if you don’t know how to script. It’s going to be almost impossible to create a game as advanced as doors if you don’t have any scripting knowledge.
Hello, you can simply use CameraOffset in the Humanoid.
game.Players.LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(0,0,0) -- Default to set it back
game.Players.LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(3,1,5) -- You can just change these values to mess with the camera!
Also, this would work for calculating the distance between them, like he said.
local Distance = (playerpos - monsterpos).magnitude
This would be in studs if you were wondering. ^
Also, if you were wondering, yes, it works in First Person and Third Person.
This would require a bit of work from both the server and the client.
In the monster, a script should be added, where when it’s chasing a player, it should add a localscript to the character and enable it. This localscript would be destroyed upon the monster no longer chasing the player.
For the client, you’d just need a simple script like so:
while task.wait(0.01) do
game.Players.LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(math.random(-1,1),math.random(-1,1),math.random(-1,1))
end
This could easily be improved, I would always recommend using BindToRenderStep for things related the camera instead.
-- THIS IS PSEUDO CODE, AND WILL NOT WORK OUT OF THE BOX.
local RunService = game:GetService("RunService")
local function CameraShake()
--camera stuff goes here
end)
RunService:BindToRenderStep("CameraShake", Enum.RenderPriority.Camera.Value + 1, CameraShake,)