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!
I want to fix the crouch issue
What is the issue? Include screenshots / videos if possible!
Whenever i equip an gun tool or any tool when crouching
its like floating up
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried to change the animation nothing work
this is screenshot of when i equip any tool (NO JUST RPG!!!)
when i crouch
This is screenshot of normal crouch
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()
i still think its due to your animations or welds, its possible that weapon idle animation with animated torso keyframe is blending with crouch animation, ensure that crouch animation has higher priority
default roblox Animate script which is located in the player’s character has ToolNoneAnim as I mentioned before, if its not removed nor overwrited it could cause problems with any tool in your game
This is just about the crouch animation when i equip tool
the rest is fine my point is how to fix this kind of issue?
how is this pointing all tool too?
default ToolNoneAnim has Torso keyframes, whenever any tool is equipped this animation is played by the Animate script inside player’s character. this could be the reason why the character is lifting up
Animate script is automatically put in the player’s character everytime he spawns. you can copy it in the test mode and then put it into StarterCharacterScripts - everything from StarterCharacterScripts is being copied and put into character whenever its added to the workspace, if you put your Animate script there it would overwrite the default one, meaning you can edit it as you want.
inside the Animate script, theres animateTool function that you can comment out in order to stop loading the default tool animations.
function animateTool()
if (toolAnim == "None") then
playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
end
Im sorry but this do not help me i have some gun system and some tools with animation inside
and this mean is defaulting all the animations i have the game
the only problem is the crouch when equip tool
so basically idk if ure scripter or not i have an old script that i use to post the same topic about this
and that script no longer work but here
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)