When i equip any tool while crouching it float me - help scripter

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to fix the crouch issue
  2. What is the issue? Include screenshots / videos if possible!
    Whenever i equip an gun tool or any tool when crouching
    its like floating up
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried to change the animation nothing work

here a screenshot of when i equip an tool
image

here screenshot of normal crouch
image

local module = {}
local Player = game:GetService("Players").LocalPlayer
local Values = Player:WaitForChild("Values")
local Character = script.Parent
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Remote = game:GetService("ReplicatedStorage"):WaitForChild("Remotes"):WaitForChild("CROUCH")
local Animations = script:WaitForChild("Animations")
local Crouch = false
local Walking = true
local PlayingWalk = false
local AnimationsTracks = {}

module.Crouch = function (self)
	Crouch = not Crouch

	if Crouch then
		AnimationsTracks["Idle"] = Humanoid:LoadAnimation(Animations:WaitForChild("Crouch"))

		AnimationsTracks["Idle"].Priority = Enum.AnimationPriority.Idle

		if AnimationsTracks["Idle"] then
			AnimationsTracks["Idle"]:Play()
			Remote:FireServer()
		end

		RunService.RenderStepped:Connect(function()
			if Crouch then
				local MoveDirection = Humanoid.MoveDirection

				if MoveDirection.Magnitude > 0 then
					Walking = true
				else
					Walking = false
				end
			end
		end)
	else
		if AnimationsTracks["Idle"] then
			AnimationsTracks["Idle"]:Stop()

			Remote:FireServer()
		end
	end
end

module.Init = function ()
	local self = setmetatable({},  {
		__index = module
	})

	UserInputService.InputBegan:Connect(function(Input, processed)
		if processed then
			return
		end
		
		if Input.KeyCode == Enum.KeyCode.C then
			self:Crouch()
		end
	end)

	return self
end

module.Init()

this is 3rd post for the same issue, please dont spam. this issue is solved here - Crouch is floating when equipping any tool - #36 by T34P07D3V

This do not help me afterall

i need a new person to help me with this problem

this doesnt mean you should create more and more posts for the same case

Im gonna need a new person to help me that it
this is just an true example of how devforum people arent really helpful and just yapping
if ure not scripter then dont reply to my post and that it
yes i did thank you for ur time and for u trying to help me
but this do not help me afterall

this was an post from january 29


and this script is outdated and is no longer working
so its was script issue afterall no the animation
and its the same topic i did and it doesnt help me anymore

which why i need to look for new person

i understand your frustration but theres no easier way than the one i gave you
btw. yes - im scripter (https://www.youtube.com/@T34P07/videos)

local Player = game:GetService(“Players”).LocalPlayer
local Values = Player:WaitForChild(“Values”)
local Character = script.Parent
local Humanoid = Character:FindFirstChildOfClass(“Humanoid”)
local RunService = game:GetService(“RunService”)
local UserInputService = game:GetService(“UserInputService”)
local Remote = game:GetService(“ReplicatedStorage”):WaitForChild(“Remotes”):WaitForChild(“CROUCH”)
local Animations = script:WaitForChild(“Animations”)
local Crouch = false
local Walking = true
local PlayingWalk = false
local AnimationsTracks = {}

module.Crouch = function (self)
Crouch = not Crouch

if Crouch then
AnimationsTracks[“Idle”] = Humanoid:LoadAnimation(Animations:WaitForChild(“Crouch”))

  AnimationsTracks["Idle"].Priority = Enum.AnimationPriority.Idle

  if AnimationsTracks["Idle"] then
  	AnimationsTracks["Idle"]:Play()
  	Remote:FireServer()
  end

  RunService.RenderStepped:Connect(function()
  	if Crouch then
  		local MoveDirection = Humanoid.MoveDirection

  		if MoveDirection.Magnitude > 0 then
  			Walking = true
  		else
  			Walking = false
  		end
  	end
  end)

else
if AnimationsTracks[“Idle”] then
AnimationsTracks[“Idle”]:Stop()

  	Remote:FireServer()
  end

end
end

module.Init = function ()
local self = setmetatable({}, {
__index = module
})

UserInputService.InputBegan:Connect(function(Input, processed)
if processed then
return
end

  if Input.KeyCode == Enum.KeyCode.C then
  	self:Crouch()
  end

end)

return self
end

module.Init()

then can u tell me if this script really outdated or no? which its was from jan 29
this wasnt animation crouch fault or the tools yes i understand what u meant

this is the script that he gave me in jan 29 2024

and it work but now this script is outdated and which why i made new post

yeah, it uses deprecated methods - now we load the animations into the Animator instead of the Humanoid

hold on wrong script

this is the official script that he gave me

local TweenService = game:GetService(“TweenService”)
local Humanoid = game:GetService(“Players”).LocalPlayer.Character:WaitForChild(“Humanoid”)
local HumanoidRootPart = game:GetService(“Players”).LocalPlayer.Character:WaitForChild(“HumanoidRootPart”)

local CrouchAnimation = script.CrouchAnimation
local CrouchTrack = Humanoid:LoadAnimation(CrouchAnimation)

local CameraInfo = TweenInfo.new(
0.3,
Enum.EasingStyle.Quint,
Enum.EasingDirection.Out,
0,
false,
0
)

local CrouchedGoal = {CameraOffset = Vector3.new(0,-1.75,0)}
local UncrouchedGoal = {CameraOffset = Vector3.new(0,0,0)}

local CrouchedTween = TweenService:Create(Humanoid, CameraInfo, CrouchedGoal)
local UncrouchedTween = TweenService:Create(Humanoid, CameraInfo, UncrouchedGoal)

local inCrouch = false

local function Crouch()
if inCrouch == false then
inCrouch = true
CrouchedTween:Play()
Humanoid.WalkSpeed = 8
CrouchTrack:Play()

HumanoidRootPart.CanCollide = false

else
inCrouch = false
UncrouchedTween:Play()
Humanoid.WalkSpeed = 16
CrouchTrack:Stop()

HumanoidRootPart.CanCollide = true

end
end

game:GetService(“UserInputService”).InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end

if input.KeyCode == Enum.KeyCode.C then
Crouch()
end
end)

it still loads the animations into humanoid - yeah it is outdated

Well is there other way that i can resolve this problem instead of the other solution that u gave me

which gonna cause me to reload all animations again and do same thing cause some tools has animation script and gonna cause me another stress

are u able to make that new script or smh?

Can anyone help me here please? im really stress out and frustated

by float do u mean rapdily flung in the air? can u show a video i cant understand from images

hey ik this is no related to the topic that i open but
i was just looking around for new crouch system in yt tutorial
can u help me how to prevent pressing C to crouch while typing in roblox chat?

local UI = game:GetService("UserInputService")
local Humanoid = script.Parent:WaitForChild("Humanoid")
local Animation = Humanoid:LoadAnimation(script:WaitForChild("Animation"))
local Run = false

UI.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.C then -- C is what key to crouch
if not Run then
Run = true
Animation:Play()
Humanoid.WalkSpeed = 8 -- Slow walkspeed cuz crouching
else
Animation:Stop()
Run = false
Humanoid.WalkSpeed = 16  -- Normal walkspeed
end
end
end)

you can also lower down the hip height whenever the tool is added while crouching to minimize the effect of floating in the air , however i definitielly recommend you the first solution i gave you and changing just the hip height could create more issues when the torso wasnt just added as a keyframe but was actually moving

maybe try this: ( i added istyping check ) ( and i put hipheight to make the first person player look like their crouching u can adjust to what u want, just dont change the hipheight = 2, only 1

local UI = game:GetService("UserInputService")
local Humanoid = script.Parent:WaitForChild("Humanoid")
local Animation = Humanoid:LoadAnimation(script:WaitForChild("Animation"))
local Run = false

UI.InputBegan:Connect(function(key, processed)
    if not UI:IsTyping() then
        if key.KeyCode == Enum.KeyCode.C then
            if not Run then
                Run = true
                Animation:Play()
                Humanoid.WalkSpeed = 8
                Humanoid.HipHeight = 1
            else
                Animation:Stop()
                Run = false
                Humanoid.WalkSpeed = 16
                Humanoid.HipHeight = 2
            end
        end
    end
end)

The script u gave me it doesnt work

Dont worry people one of the scripter from devforum in my discord has fix the issue

the issue was priority in the script

but yea now is fixed like i wanted

i wanted to sorry for T34P07 and Noobinafishtank
for any waste of time or any rude behaviour or bad manners toward u both

so yea ty again

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.