Hey Devs,
my problem is that a Crouch Animation i made, which looks like this:
looks like this In-Game:
Here is the Code for this (works fine):
local player = game.Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")
local Humanoid = player.Character:FindFirstChild("Humanoid")
local Animation = Instance.new("Animation", player.Character)
Animation.AnimationId = "rbxassetid://10034496439"
local Animate = Humanoid:LoadAnimation(Animation)
UserInputService.InputBegan:Connect(function(Key)
if Key.KeyCode == Enum.KeyCode.C then
Crawling = true
Sprinting = false
Animate:Play()
end
end)
UserInputService.InputEnded:Connect(function(Key)
if Key.KeyCode == Enum.KeyCode.C then
Crawling = false
Humanoid.WalkSpeed = 10
Animate:Stop()
end
end)
Humanoid.Running:Connect(function(speed)
if speed > 0 then
Animate:AdjustSpeed(1)
else
Animate:AdjustSpeed(0)
end
end)
Im not sure what I did wrong tho…