Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Gun animations work just fine in the animation editor, but they glitch when played in-game?

Another odd issue involving animations, but this time it's a weird offset glitch(?) happening on the gun animations I made, it basically makes the gun stay in weird positions during the animation instead of being in the right spot.

This is what the animation is supposed to be like: https://prnt.sc/uoilyj

This is how the animations is in-game: https://prnt.sc/uoin3y

This is the animation timeline: https://prnt.sc/uoinr9

And this is the script that sets the Motor6D:

local function equipGun(player, weapon)
	local char = player.Character
	
	local newWeapon = weapon:Clone()
	
	local motor6D = Instance.new("Motor6D")
	motor6D.Part0 = char.RightHand
	motor6D.Part1 = newWeapon.Handle
	
	motor6D.Parent = newWeapon
	newWeapon.Parent = char
end

P.S: The gun is a model, and the handle is an invisible part connected to the gun's body that is connected to the rest of the gun parts. The animations are mine and they are played on a LocalScript in StarterCharacterScripts

If needed, I'll edit this to answer questions and provide more details.

2 comments

0

Try adding reseted keyframes in the keyframes you dont want to move intead of leaving it blank. MAYBE could be a solution avoiding a blank keyframe of other animation overlaping.

0

I'm sorry for the inconvenience but I actually dont know what that is or how to do it

1 answer

I believe that two issues could cause this.

  1. Is the handle sitting correctly in the hand of the humanoid compared to the weapon? If the handle is in a weird position this can surely happen. Try moving the handle and rewelding it and see if the gun "glitch" position has changed. If not, there is another issue.

  2. Do you weld/attach the weapon to the handle via script? If so, try connecting them in studio directly. The script may not be quick enough at attaching the weapon, resulting in the weapon being very weird compared to the handle.

2 comments

0

To answer both questions: No, the positions doesn't change, the gun is welded manually with a plugin and stored in ReplicatedFirst, and the gun's Handle is positioned through the animation, and deleting the Handle's keyframes only makes the handle appear in yet another weird position.

0

I changed the gun's Handle position and re-welded it, exact same result, and just incase this is crucial, there is no other animation playing that overlaps the Handle's current keyframe

This discussion is preserved as it was. New answers, comments, and votes are closed.