Hi there, I was working on a gear for a game I am working on, and I entered a local server with two clients to see how the animations looked for other players. The animation looked fine for the person doing it, but for other players, not so much. I am not exactly sure whether this is an issue with how I set the Tool’s root Motor6D (The tool is set around a base part, so all of the parts stay together), or if its something to do with how I executed the animations.
So the issue is, when I run the equip
animation, the tool’s root Motor6D has its Part0
set to the character’s right hand. The tool is brought and aligned to the hand like it is supposed to, but it isn’t affected by the animation. The tool is supposed to move so that it looks more like the character is grabbing it, rather than sticking their arm through it. The rest of the characters animation (apart from the tool’s) plays normally.
Now here is where it is weird: The tool actually fixes itself when another character comes close to it, and I have absolutely no idea why. Here is a GIF that I took of it happening. (At the start, the case is not offset from the right hand, but once another character walks near it, it fixes for that player.)
https://streamable.com/6933p8
Resources (Scripts, Model, etc.)
Model:
ServerScript in ServerScriptService:
local function getAnimationFromId(AnimId)
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://".. AnimId
return animation
end
local animations = {
["MedkitAdvanced"] = {
equip = (getAnimationFromId(6776533191)),
hold = (getAnimationFromId(6777024407))
}
}
function equipItem(plr, itemID, invItem)
local char = plr.Character or plr.CharacterAdded
local hum = char:WaitForChild("Humanoid")
local anmtr = hum:FindFirstChildOfClass("Animator")
if itemID == "MedkitAdvanced" then
local equipAnim = anmtr:LoadAnimation(animations[itemID].equip)
local holdAnim = anmtr:LoadAnimation(animations[itemID].hold)
local defaultAttach = char:FindFirstChild("RightHand")
local motor = Instance.new("Motor6D", invItem.Root)
motor.Name = "Attach"
motor.Part1 = invItem.Root
motor.Part0 = defaultAttach
if invItem and defaultAttach and motor then
hum:EquipTool(invItem)
equipAnim:Play()
equipAnim.Stopped:Connect(function()
if invItem.Parent == char then
holdAnim:Play()
end
end)
end
end
end
game.ReplicatedStorage.Equipment.Equip.OnServerInvoke = function(plr, item)
local invItem = plr:FindFirstChild("Backpack"):FindFirstChild(item)
if invItem then
print(invItem)
equipItem(plr, item, invItem)
end
end
In addition, what you do to equip is just run this command:
game.ReplicatedStorage.Equipment.Equip:InvokeServer("MedkitAdvanced")
I have tried removing Head/Body turning, and I have tried both having the Motor6D parented to the root by default, and having it added via Instance.new()
but still the same issue.
Other than this, I have absolutely no idea what is causing this, any ideas that I can think of that might be the problem are countered by the fact that it fixes itself when a player comes near. Thank you for reading!