I’ve got a fairly simple system for a sort of hovering wings accessory that creates the rig, Welds it to the players back, and plays the animation on it after changing their own animations to the hovering animation pack. This system works fine, however the issue is coming into play as I’m trying to display these on other characters that have them as well. The wings display but the flapping animations won’t play for other characters as shown below:
For context, the wings are created locally on a client by client character by character basis using a server set attribute “ServerFlying”. The wings appear fine on other players, however for some reason the animation is not visible. Initially I could get it to play by hitting into the other character ("a part within the wing was set to cancollide true) which oddly seemed to update it to begin playing the new animation, however upon thinking that was the cause to begin with and changing it the behavior is now permanent with no way I can find to get it to play.
The basics of the code that gets these to display is as follows (Only shows essentials so some self calls dont show the overall function just the relevant connection):
local function WeldAccessoryToCharacter(characterModel, accessory) --For Rig Welding
local accessoryAttachment = accessory:FindFirstChildWhichIsA("Attachment", true)
if not accessoryAttachment then
warn("No attachments found in accessory. Accessory was not attached.")
return
end
local attachmentName = accessoryAttachment.Name
local attachTo = characterModel:FindFirstChild(attachmentName, true)
if not attachTo or not attachTo:IsA("Attachment") then
warn(string.format("No attachment named %s found in character. Accessory was not attached.", attachmentName))
return
end
local Handle = accessory:FindFirstChild("HumanoidRootPart")
if not Handle then
warn("Attachment has no handle. Accessory was not attached.")
return
end
accessory.Parent = characterModel
Handle.CFrame = attachTo.WorldCFrame * accessoryAttachment.CFrame:Inverse()
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = Handle
print(attachTo.Parent.Name)
Weld.Part1 = attachTo.Parent
Weld.Parent = Handle
end
self._FlyingChanged = self.Player:GetAttributeChangedSignal("ServerFlying"):Connect(function()
if self.Player:GetAttribute("ServerFlying") == true then
if self.Character then
self:StartFlying()
end
else
if self.Character then
if self.Wings then
self.Wings:Destroy()
end
if self.WingsAnim then
self.WingsAnim:Destroy()
end
end
end
end)
function LocalPlayer:StartFlying()
if self.Character then
self.Wings = script.OrigamiWings:Clone()
WeldAccessoryToCharacter(self.Character, self.Wings)
local Animator = self.Wings:WaitForChild("AnimationController")
self.WingsAnim = Animator:LoadAnimation(self.Wings:WaitForChild("Flapping"))
self.WingsAnim.Looped = true
self.WingsAnim:Play(0, 1, .75)
end
end
Not quite sure what’s going on here but would greatly appreciate some help, thanks!
EDIT: I’ve found that the cause of this particular issue is due to a currently ongoing engine bug as detailed here. I’ve tried the given workaround in a few variations parenting and loading the animation first and then welding to the character, as well as parenting loading and playing the animation before welding. These all work for your own local character, however I can’t get this workaround functioning for other characters.