You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
To fix my crouch issue
What is the issue? Include screenshots / videos if possible!
My issue is that when i equip one of the tool
while crouching it float me in air
No matter which tool it keep floating me
in air
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have try to make different crouch anim but nothing work
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()
To be honest with you my crouch script it do not connected to the gun system or animated it same way
I believe that it probably the script crouch issue for sure
You might need to create a new crouch animation for when the player is holding a Tool. Essentially you can use your existing crouch animation as a base, and make it so the character is also holding his hand up like they would do when holding a Tool
When a player equips a Tool you’ll need to stop the normal crouch animation and play the Tool crouch animation and do the opposite for when they unequip it
You’ll need to add a new function for your module that allows you to switch the currently playing animation, something like this should work:
local currentAnimation = -- The currently playing animation
module.Play = function (newAnimation)
currentAnimation:Stop()
currentAnimation = newAnimation
currentAnimation:Play()
end
I though you were using a ModuleScript not a LocalScript
Modules should be created inside of a ModuleScript in order to be able to use the functions inside of it from different scripts, otherwise you won’t be able to fix your crouching issue by changing the animation