You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
When the player jumps and hits the ground the camera shakes
What is the issue? Include screenshots / videos if possible!
I don’t know how to do this.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I looked on YouTube and here and I still cant solve this problem.
Use Humanoid.StateChanged to detect whenever the player has landed by checking if the new state argument (the second one) is equal to HumanoidStateType.Landed (as this fires whenever the player, well, lands on a surface), and use a module or script to produce the shake (e.g EZShake)
You formatted this if statement wrong, it should be
if newstate == Enum.HumanoidStateType.Landed then
That is what is causing your error, in your case your newState was Running, aka Enum.HumanoidStateType.Running and on that you were looking for another state type, so you were essentially doing: if Enum.HumanoidStateType.Running.Enum.HumanoidStateType.Landed then
local camera = workspace.CurrentCamera
local cameramodule = require(game.ReplicatedStorage.CameraShaker)
local camshake = cameramodule.new(Enum.RenderPriority.Camera.Value, function(shakeCFrame)
camera.CFrame = camera.CFrame * shakeCFrame
end)
camshake:Start()
local humanoid = script.Parent.Humanoid
humanoid.StateChanged:Connect(function(oldstate, newstate)
if newstate == Enum.HumanoidStateType.Landed then
print("Starting Camera Shake")
camshake:Shake(cameramodule.Presets.Explosion)
script.Parent["Ground smash sound"]:Play()
end
end)
Hey, glad you got it working, just so you know for the future, use three backticks (`) at the beginning and end of your code to format it nicely like this:
if myCode == "nice" then
return true
else
print("Please format")
end