local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local crouchAnim = script.Animation
local crouchTrack = humanoid:LoadAnimation(crouchAnim)
local isCrouching = false
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.C then
isCrouching = not isCrouching
if isCrouching then
crouchTrack:Play()
humanoid.HipHeight = -1
humanoid.WalkSpeed = 8
else
crouchTrack:Stop()
humanoid.HipHeight = 0
humanoid.WalkSpeed = 16
end
end
end)
everything works fine but my body goes underground or my legs goes underground? Why is that?