This is super! So do you have to use a looped animation for the idle animation when equipping the gun?
Nvm I fix it already but thanks for tryin to help
Hello, this tutorial as been tremendously helpful and I have had a great time with animating tools.
However, I encountered two issues:
-
The animation doesn’t line up with the editor.
the file that shows the editor had errors uploading but the left arm should be going behind the character’s back -
I have found that idleAnimations took very long to load and that removing the ‘DisconnectM6D’ RemoteEvent solved this issue. Have I done something wrong and is ‘DisconnectM6D’ a necessity?
Thank you for your time.
Edit: well, it appears that the animation not lining up problem was purely my fault and not the tutorial’s. I had forgotten to stop the idleAnim when the fireAnim was activated causing the fireAnim and the idleAnim to override each other and cause problems. sorry for taking precious time over something that was easily prevented.
One think I noticed is that the part being animated must not be named “Handle”, or it will stick to the hand and not playing the animation
How about an rotate like-connection? Can i just freely edit the 6DMotors without being worried that it would ruin?
For Example ^
I am making a sword, there is an issue that sword is not in right place.
How it looks in animation editor: https://gyazo.com/07d085b605b973003ad0cb61f0978baf
How it looks in game: https://gyazo.com/d8cb586ad82f50e60f149119f7c95395
I’d like to hear advice, Thanks.
To everyone who still suffers from an issue where tool is being not in the right place:
You might wanna try getting BodyAttach part into the right direction, just like with classic handles of tools. I myself am marking front faces of them with a hinge, and then rotate everything from there. You can use decals, built-in orientation indicator or whatever else you prefer.
For some reason, whenever my character dies and then when I equip the tool again the pistol does not show up in the characters hands and just falls out of the map. I think its something that I did wrong but im gonna go check again
i’ve got issues
first issue is the gun isn’t in the correct place when i equip it
and second the gun teleports to the torso when it should be in the hand
and lastly the animation for the gun sometimes plays
i am going to do more complicated animations later,
How would I even hold it in the first place? like a holding idle animation. Could anybody link a tutorial of that or direct me on how to do it? thanks.
a localscript that plays the idle animation will give you the result I assume you want
script.Parent.Equipped:Connect(function()
idleAnim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.IdleAnimation)
idleAnim:Play()
end)
script.Parent.Unequipped:Connect(function()
idleAnim:Stop()
end)
however, do mind that Humanoid:LoadAnimation()
is deprecated.
Does anyone know why this happens?
nvm if found the soulution
Hello I have follows your tutorial step by step, but when I play the animation the arms are animating but the gun isn’t at right place
photos:
(in Animator)
(ik my animation is trash i’ve never animated K!)
(in game)
Same from server’s POV
Here’s the script
Client:
--Made by Beastcraft_Gaming
--Variables--
--Services
local replicatedStorage = game:GetService("ReplicatedStorage");
local CAS = game:GetService("ContextActionService");
local Players = game:GetService("Players");
--Player Variables
local player = Players.LocalPlayer;
local character = player.Character or player.CharacterAdded:Wait();
local humanoid: Humanoid = character:WaitForChild("Humanoid");
local RightArm = character:WaitForChild("Right Arm");
local Animator = Instance.new("Animator", humanoid);
--Event Folder
local eventFolder = replicatedStorage:WaitForChild("Events");
--other folders
local gunFolder = eventFolder:WaitForChild("GunEvents");
--Gun Events
local equipEvent = gunFolder:WaitForChild("EquipEvent");
--Folders
local gunsFolder = replicatedStorage:WaitForChild("GunsFolder");
--Tables
local GunsTable = gunsFolder:GetChildren();
local BindTable = require(script.Parent:WaitForChild("KeyBindings"));
local function equipTool(name)
equipEvent:FireServer(name);
end
for key,gunName in pairs(BindTable) do
CAS:BindAction(gunName, equipTool, false, Enum.KeyCode[key]);
end
Server:
--Made by Beastcraft_Gaming
--Variables--
--Services
local replicatedStorage = game:GetService("ReplicatedStorage");
--Event Folder
local eventFolder = replicatedStorage:WaitForChild("Events");
--other folders
local gunFolder = eventFolder:WaitForChild("GunEvents");
--Gun Events
local equipEvent = gunFolder:WaitForChild("EquipEvent");
--Main
equipEvent.OnServerEvent:Connect(function(player, name)
local gunsFolder = replicatedStorage:WaitForChild("GunsFolder");
local tool: Tool = gunsFolder[name]:Clone();
--Player Variables
local character = player.Character or player.CharacterAdded:Wait();
local humanoid: Humanoid = character:WaitForChild("Humanoid");
local RightArm = character:WaitForChild("Right Arm");
--Equip the gun
if not character:FindFirstChild(tool.Name) then
tool.Parent = player.Character;
humanoid:EquipTool(tool);
end
--Rig The tool
local bodyAttach = tool:WaitForChild("BodyAttach");
local motor = Instance.new("Motor6D", RightArm);
motor.Part0 = RightArm;
motor.Part1 = bodyAttach;
--Create Animator
local Animator = humanoid:FindFirstChildOfClass("Animator");
if not Animator then
Animator = Instance.new("Animator", humanoid);
end
--Play equip animation
local equipAnim = tool:WaitForChild("Animations"):WaitForChild("Equip");
local equipTrack = Animator:LoadAnimation(equipAnim);
equipTrack:Play();
end);
In my opinion this is very good tutorial!
Hello
i need some help, the rocket is not accurate to the animation playing in studio
while also playing in game.
There is no grip weld that interferes with this. If im doing something wrong, can you pls tell me??
How to fix this? The tool dosent rotate with arms.
Despite what it says in the tutorial, I fixed that by setting the parent of the model to be the arm instead of the rootpart. You don’t get as much animation freedom but it will work with what you are doing.
This is a very great tutorial and I appreciate the effort into making it! while testing animations, I ran into a problem where the gun add-ons(like a magazine or bolt) wont move while in game, but the gun and players are animated. I had noticed other people has this problem and I couldn’t seem to find a complete solution.(this also affects the magazine)
for example: this is what the gun looks like in the animator(moon animator)
this is what the bolt looks like in game
there is a motor6d that connects the bolt to the body attach, and the body attach is connected to right arm.
Edit: I duplicated the gun and made it into an accessory to be fit in a holster, and this gun has an animated blow back(it partially slides back), even though its on the players leg, as an accessory.
Edit2: I forgot to parent the gun to player when the animation was about to be played :P.
Hi, I’ve encountered a different issue when using this tutorial. I need to animate a vehicle with a player / npc controlling, and I have used this tutorial, and just change the CFrame every time the player / npc moves.
It has worked well, until I have encountered an issue where my entire character is pointed towards the ground, and is changing its Pitch
https://gyazo.com/cccf522df6c8aa6ef9116dc7b040d6ef
Local Script, simply updates the server on the lawnmower’s new cframe every frame.
local StartCFrame = cloneChar:GetPivot()
local radPerSec = math.rad(9*speed)
local animation = Instance.new("Animation")
animation.AnimationId = animId
local animTrack = cloneChar.Humanoid:LoadAnimation(animation)
animTrack.Priority = Enum.AnimationPriority.Movement
animTrack.Looped = true
local curAnimSpeed = 0
animTrack:Play()
animTrack:AdjustSpeed(curAnimSpeed)
while controlEnded == false do
local StartTick = tick()
RunService.Heartbeat:Wait() -- wait a frame
if (turningRight and not turningLeft) or (turningLeft and not turningRight) then
local secondsElapsed = tick() - StartTick
--turn left/right
local oppositeMultiplier
if turningRight and not turningLeft then
--eq. means lm turns to create a 90 stud rad. circle
oppositeMultiplier = 1
else
oppositeMultiplier = -1
end
local rotateAmount = oppositeMultiplier*secondsElapsed*radPerSec
--character:PivotTo(character:GetPivot()*CFrame.Angles(0, rotateAmount, 0))
--character:PivotTo(character:GetPivot():ToObjectSpace(CFrame.Angles(0, rotateAmount, 0)))
local _, yOrientation = cloneChar:GetPivot():ToOrientation()
cloneChar:PivotTo(CFrame.new(cloneChar:GetPivot().p)*CFrame.Angles(0, rotateAmount + yOrientation, 0))
StartCFrame = cloneChar:GetPivot()
end
if (goingForwards and not goingBackwards) or (goingBackwards and not goingForwards) then
--move forwards/backwards
local oppositeMultiplier
if goingForwards then oppositeMultiplier = -1 else oppositeMultiplier = 1 end
local SecondsElapsed = tick() - StartTick
local StudsToMove = SecondsElapsed*speed*(oppositeMultiplier)
local CurrentCFrame = StartCFrame:ToWorldSpace(CFrame.new(Vector3.new(0, 0, StudsToMove)))
local offset, w = ObstructionsModule:FindObstructions(CurrentCFrame.Position, true, true)
if math.abs(offset) > 7 or w then
continue
end
cloneChar:PivotTo(CurrentCFrame)
--Y offset of LM
--local offset = ObstructionsModule:FindObstructions(cloneCharacter.PrimaryPart.Position, true, true)
local _, yOrt = CurrentCFrame:ToOrientation()
local offsetPos = CurrentCFrame.Position
offsetPos = Vector3.new(offsetPos.X, offset + BaseY, offsetPos.Z)
cloneChar:PivotTo(CFrame.new(offsetPos) * CFrame.fromOrientation(0, yOrt, 0))
--Model:TranslateBy(Vector3.new(Model:GetPivot().Position.X, (BaseY + offset) - Model:GetPivot().Position.Y, Model:GetPivot().Position.Z)
StartCFrame = cloneChar:GetPivot()
end
local remoteEventToFire = ReplicatedStorage.EventsAndFunctions.UpdatePlayerControlledLMCFrame
if turningLeft or turningRight or goingForwards or goingBackwards then
--fire update event to server
curAnimSpeed = 1
animTrack:AdjustSpeed(curAnimSpeed)
remoteEventToFire:FireServer(StartCFrame)
else
curAnimSpeed = 0
animTrack:AdjustSpeed(curAnimSpeed)
remoteEventToFire:FireServer()
end
end```
I don’t understand. Sorry. Can you try to make it a little easier?