I’m trying to make it so when you crouch, the camera doesn’t just instantly lower and instead just eases downwards. I’m not sure how to do this, I know I have to tween it but I’m not sure how to go about it.
I’ve messed around with tweens but I haven’t gotten anything to work. They aren’t in this snippet though.
--Crouch Start
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift and busy.Value == false then
print("Player began crouching")
busy.Value = true
humanoid.WalkSpeed = 3.88
humanoid.CameraOffset = Vector3.new(0, -0.50, 0)
while busy.Value == true do
wait(1)
end
end
end)
--Crouch Stop
UIS.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift and busy.Value == true then
print("Player stopped crouching")
busy.Value = false
humanoid.WalkSpeed = 13.11
humanoid.CameraOffset = Vector3.new(0, 0, 0)
end
end)
you are attempting to play a tweeninfo, this is incorrect. first you must make the actual tween to play
local TweenService = game:GetService("TweenService")
local obj -- put whatever you want to tween here, i think this would be the humanoid
local Twinfo-- put your tweeninfo here, dont name it TweenInfo
local Goals = {}
Goals.(put your property here) = (put the value of property here) -- in this case, you would probably want to set the CameraOffset, so maybe do Goals.CameraOffset = (whatever)
local Tween = TweenService:Create(obj, Twinfo, Goals)
Tween:Play()