-
What do you want to achieve? Keep it simple and clear!
So just curious question, i’m doing some crouch animation where player can move, all tutorials i found about movement animations is literally copy player animator script and change id’s, but i literally need to animation happen only after C keycode, this is small video about what i need Crouch System Glitch - YouTube -
What is the issue? Include screenshots / videos if possible!
Literally no idea how to do that - What solutions have you tried so far? Did you look for solutions on the Developer Hub? Looked though tons of youtube videos
Code:
local UIS = game:GetService("UserInputService")
local CrouchKeycode = "C"
local CrouchStart = Instance.new("Animation")
CrouchStart.AnimationId = "rbxassetid://11929520919"
local CrouchMovement = Instance.new("Animation")
CrouchMovement.AnimationId = "rbxassetid://11929836057"
local player = game:GetService("Players").LocalPlayer
local char = player.Character
local humanoid = char:WaitForChild("Humanoid")
local Animator = humanoid:FindFirstChild("Animator")
UIS.InputBegan:Connect(function(key, GPE)
if GPE then return end
print("Player Triggerred"..key.KeyCode.Name)
if key.KeyCode == Enum.KeyCode[CrouchKeycode] then
local track = Animator:LoadAnimation(CrouchStart)
track:Play()
humanoid.WalkSpeed = 7
local moveTrack = Animator:LoadAnimation(CrouchMovement)
moveTrack:Play()
end
end)