How to make C to CROUCH/CRAWL in Roblox Studio!

Опубликовано: 31 Май 2026
на канале: CopyPaste RobloxStudio Tutorial
2,104
41

LocalScript:
local UserInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character or player.ChildAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local normalWalkSpeed = 16
local crawlWalkSpeed = 8
local crawlHipHeight = 0

--Assuming the animation is stored in ReplicatedStorage
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local crawlAnimation = ReplicatedStorage:WaitForChild("CrawlAnimation") --The name of the animation
local crawlAnimationTrack = humanoid:LoadAnimation(crawlAnimation)

local function onInputBegan(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.C and not gameProcessed then
humanoid.WalkSpeed = crawlWalkSpeed
humanoid.HipHeight = crawlHipHeight
crawlAnimationTrack:Play()
end
end

local function onInputEnded(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.C then
humanoid.WalkSpeed = normalWalkSpeed
humanoid.HipHeight = normalHipHeight
crawlAnimationTrack:Stop()
end
end

UserInputService.InputBegan:Connect(onInputBegan)
UserInputService.InputEnded:Connect(onInputEnded)