This doesn’t work. It doesn’t do the shake when player joins.
Also the example code justs makes alot of undefined variables, a better example would be good please
This doesn’t work. It doesn’t do the shake when player joins.
Also the example code justs makes alot of undefined variables, a better example would be good please
It does work. I use this in just about all my projects. The only undefined item in the example is the actual ‘require’ of the module:
local CameraShaker = require(theCamShakeModule)
If you’re having trouble doing something specifically with it, please let me know and I can try to help.
I did that. I put it in rep storage.
Here is the script that I am tryna do this:
local camera = workspace.CurrentCamera
local CameraShaker = require(game:GetService('ReplicatedStorage').CameraShaker)
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCf)
camera.CFrame = camera.CFrame * shakeCf
end)
camShake:Start()
-- Explosion shake:
camShake:Shake(CameraShaker.Presets.Explosion)
It does work, and you just stated your exact problem.
local camera = workspace.CurrentCamera
local CameraShaker = require(game:GetService('ReplicatedStorage'):WaitForChild("CameraShaker"));
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCf)
camera.CFrame = camera.CFrame * shakeCf
end)
camShake:Start()
-- Explosion shake:
wait(5);
camShake:Shake(CameraShaker.Presets.Explosion)
I slightly modified your code (wait(5)) and it works perfectly. You have it running too quickly.
Doesn’t work still! Here is a screenshot.
local camera = workspace.CurrentCamera
local CameraShaker = require(game:GetService('ReplicatedStorage'):WaitForChild("CameraShaker"));
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCf)
camera.CFrame = camera.CFrame * shakeCf
end)
camShake:Start()
-- Explosion shake:
wait(10);
camShake:Shake(CameraShaker.Presets.Explosion)
Should I use pcall?
Wait, are you using a script, and not a local script?
I am using a script as seen in the screenshot 2 messages up.
local camera = workspace.CurrentCamera
local CameraShaker = require(game:GetService('ReplicatedStorage'):WaitForChild("CameraShaker"));
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCf)
camera.CFrame = camera.CFrame * shakeCf
end)
camShake:Start()
-- Explosion shake:
wait(10);
local didWork, didntWork = pcall(function()
camShake:Shake(CameraShaker.Presets.Explosion)
end)
if didntWork then
print(didntWork)
end```
I used pcall and nothing happened, success then? Still didn't shake though
There’s your problem. How do you expect this to work with a script? This needs to be running in a local script. Before using this module, or any other modules, you might want to first learn the difference between a local and server script, and also before claiming that this module doesn’t work.
Oh. Ok. I know what the difference is lol.
Apparently not, why would you try and use a server script with this…?
It works! Horray! Sorry I thought it had to be used in a server script. It’s a bit slow the shake though.
You can take a look at the API for different ways to shake the camera, faster or slower. GitHub - Sleitnick/RbxCameraShaker: Camera shake effects for Roblox games
Thanks so much
#VeryHelpful
How can i set this up?
I’m not experienced with module scripts at all.
Woah very smooth and useful. Thanks!
This is a very nice system to work with. Very advanced, very smooth. I’ve been using this since 2019!
Wait what?
I do that cause of readability and I thought it helped with performance in a minor way, can you send a screenshot of this minor performance penalty, and is it safe to assume that local wfc = game.WaitForChild would incur the same minor performance penalty or more?
It used to help with performance, but Luau changed some things so that this isn’t the case. See Luau page common Lua tricks of caching the method in a local variable aren’t very productive in Luau and aren’t recommended either
(table access to Vector3 may also be faster iirc, not an expert).
Your wfc thing is just the same principle, and should no longer be used. (call as a method instead)
Thank you that’ll be helpful in the future just that I’ve done some testing and found that local v3 = Vector3.new will impact performance 1/5 times while v3 = Vector3.new will be the one to impact it the most 4/5.
With this information I’ll be using local v3 instead of Vector3.new because of readability and that slight performance gain, the links below show the tests I’ve tested it over 30 times now and it always lead to this 1/5.