What do you want to achieve? I want to make a system so camera shake will be applied when I shoot an ACS gun.
What is the issue? I straight up can’t even think on how to do it, There’s no tutorial and I see many custom ACS games use it; Yet normal 2.0.1 ACS doesn’t have it!
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Looked everywhere, even Youtube. I cannot find anything
heres the solution that came to my mind
basically: just tell the client that your specific gun was fired through a remoteEvent so it can apply a camera offset
localscript:
local camera = workspace.CurrentCamera
local camerashake = 0
local runService = game:GetService("RunService")
local player = game.Players.LocalPlayer
local character = player.Character
local shaking = false
local ShakeEvent = game.ReplicatedStorage.Events.ScreenShake
local StopShakingEvent = game.ReplicatedStorage.Events.EndScreenShake
ShakeEvent.OnClientEvent:Connect(function(shake)
shaking = true
camerashake = shake
end)
StopShakingEvent.OnClientEvent:Connect(function()
shaking = false
character:FindFirstChildOfClass("Humanoid").CameraOffset = Vector3.new(0,0,0)
end)
runService.RenderStepped:Connect(function()
if shaking == true then
local currentTime = tick()
local bobbleX = math.cos(currentTime * camerashake) --* .25
local bobbleY = math.abs(math.sin(currentTime * camerashake)) --* .25
local bobble = Vector3.new(bobbleX+math.random(-1,1), bobbleY+math.random(-1,1), 0)
character:FindFirstChildOfClass("Humanoid").CameraOffset = bobble
end
end)
although this is meant to cover MUCH MUCH MUCH broader things than a gun being fired, and i honestly wrote it last year so it kind of sucks
and whatever you do: dont copy and paste this for your guns firing, because runservice will constantly redo the script, its really more of an example on how to actually offset the camera than anything else
unless you’re asking for recoil, which is just a completely separate thing
ok well what i coded was meant for everyone, but you can take
local currentTime = tick()
local bobbleX = math.cos(currentTime * camerashake) --* .25
local bobbleY = math.abs(math.sin(currentTime * camerashake)) --* .25
local bobble = Vector3.new(bobbleX+math.random(-1,1), bobbleY+math.random(-1,1), 0)
character:FindFirstChildOfClass("Humanoid").CameraOffset = bobble
and through a remoteEvent, you could bobble the camera offset once by alot, and then tween the offset back to 0,0
specifically, when your gun activates, you could activate said remoteEvent and target it towards the client whose gun activated, and then do the camerashake magic from there