Hi :), I want that the player can't jump while being crawled but idk how to do it.
local uis = game:GetService("UserInputService")
local crawlAnimation = script:WaitForChild("Crawl")
local crawlIdle = script:WaitForChild("CrawlIdle")
local isCrawling = false
local humanoid = script.Parent:WaitForChild("Humanoid")
local sprintscript = humanoid.Parent.SprintScript
local StarterGui = game:GetService('StarterGui')
local loadedIdleAnim = humanoid:LoadAnimation(script:WaitForChild("CrawlIdle"))
local loadedCrawlAnim = humanoid:LoadAnimation(script:WaitForChild("Crawl"))
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.C then
if isCrawling then
isCrawling = false
if loadedCrawlAnim then loadedCrawlAnim:Stop() end
loadedIdleAnim:Stop()
game.ReplicatedStorage.OnCrouchBegun:FireServer(humanoid, 16, 50)
sprintscript.Disabled = false
humanoid.HipHeight = 0
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
elseif not isCrawling then
isCrawling = true
loadedIdleAnim = humanoid:LoadAnimation(crawlIdle)
loadedIdleAnim:Play()
game.ReplicatedStorage.OnCrouchBegun:FireServer(humanoid, 8, 0)
sprintscript.Disabled = true
humanoid.HipHeight = -2
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
end
end
end)
game:GetService("RunService").RenderStepped:Connect(function()
if not isCrawling then return end
if humanoid.MoveDirection.Magnitude > 0 then
if not loadedCrawlAnim then loadedCrawlAnim = humanoid:LoadAnimation(crawlAnimation) end
if loadedCrawlAnim.IsPlaying == false then loadedCrawlAnim:Play() end
else
loadedCrawlAnim:Stop()
loadedIdleAnim:Play()
end
end)

3 comments
if this does not work then edit your question and put the LocalScript that handles OnCrouchBegun remote event on the client
this is because it's possible that humanoid states may only be enabled/disabled in LocalScript and not basic Script i am not sure about that
it worked thx :)