I’m a beginner scripter, so please don’t make fun of my scripting skills.
i would like to disable the camera bobbing whenever i want.
Code:
-- The code is here. If you help me to how to disable it on jumps / landings it will be cool.
local Humanoid = script.Parent:FindFirstChild("Humanoid")
local Character = script.Parent
Humanoid.Jump:Connect(function()
script.Parent:WaitForChild("CameraBobbing").Disabled = true
end)
Humanoid.FallingDown:Connect(function()
script.Parent:WaitForChild("CameraBobbing").Disabled = false
end)
Oh, sorry. I believe just using the :GetPropertyChangedSignal should work better here.
local Humanoid = script.Parent:FindFirstChild("Humanoid")
local Character = script.Parent
Humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
if Humanoid.Jump then
script.Parent:WaitForChild("CameraBobbing").Disabled = true
else
script.Parent:WaitForChild("CameraBobbing").Disabled = false
end
end)
task.wait()
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local CameraBob = Character:WaitForChild("CameraBobbing")
Humanoid.StateChanged:Connect(function(NewState)
if NewState == Enum.HumanoidStateType.Jumping then
CameraBob.Disabled = true
elseif NewState == Enum.HumanoidStateType.FallingDown then
CameraBob.Disabled = false
end
end)
I’m not sure what “CameraBobbing” is here, I assume it’s a script.