-
What do you want to achieve? Hello, so i want to make a camera shake system with a value, the more the value is high the more the shaking is intense.
-
What is the issue? I can’t manage to do it.
-
What solutions have you tried so far? I looked on forums and tried myself.
You should really google things before you ask them on the forum, there are tons of tutorials about this
First, Insert an RemoteEvent on ReplicatedStorage, rename it ShakeEvent
Create an script in workspace and copy the script below.
local ShakeEvent = game.ReplicatedStorage:WaitForChild("ShakeEvent")
wait(0.01)
ShakeEvent:FireAllClients(0.5) --the 0.5 means how long the shake event will be.
Once you did that, create an script on StarterPlayer > StarterCharacterScripts
Copy the script below:
local ShakeEvent = game.ReplicatedStorage:WaitForChild("ShakeEvent")
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
ShakeEvent.OnClientEvent:Connect(function(Time)
local StartTime = tick()
repeat
wait()
local EndTime = tick()
local xOffset = math.random(-405,200)/500
local yOffset = math.random(-405,200)/500
local zOffset = math.random(-405,200)/500
Humanoid.CameraOffset = Vector3.new(xOffset, yOffset, zOffset)
until EndTime - StartTime >= Time
Humanoid.CameraOffset = Vector3.new(0, 0, 0)
end)
See if works.