Hello! I am trying to create a morph, where you touch a brick and animated wings get cloned onto the humanoid whom touched the brick.
The problem is that when the player/humanoid touches the brick the wings get cloned but loose the flapping animation on them.
I have tried :
-making the animation play on loop
-the animation only plays while
“humanoid.Running”
I cant come up with any other ways to get around this.
The wings are also a humanoid so the animation can work, and is inside the preview morph. The wings flap perfectly on the preview morph but when touched the brick they don’t work.
robloxapp-20230328-1347172.wmv (1.6 MB)
This is the animation script:
local animation3 = script:WaitForChild('Animation3')
local humanoid = script.Parent.Parent:WaitForChild('Humanoid')
local dance3 = humanoid:LoadAnimation(animation3)
dance3:Play()
Morph Script:
function onTouched(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("Wings") == nil then
local g = script.Parent.Parent.Wings:clone()
g.Parent = hit.Parent
local C = g:GetChildren()
for i=1, #C do
if C[i].className == "Part" or C[i].className == "UnionOperation" or C[i].className == "WedgePart" or C[i].className == "MeshPart" then
local W = Instance.new("Weld")
W.Part0 = g.HumanoidRootPart
W.Part1 = C[i]
local CJ = CFrame.new(g.HumanoidRootPart.Position)
local C0 = g.HumanoidRootPart.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.HumanoidRootPart
end
local Y = Instance.new("Weld")
Y.Part0 = hit.Parent.LowerTorso
Y.Part1 = g.HumanoidRootPart
Y.C0 = CFrame.new(0, 0, 0)
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
if h[i].className == "Part" or C[i].className == "UnionOperation" or C[i].className == "WedgePart" or C[i].className == "MeshPart" then
h[i].Anchored = false
h[i].CanCollide = false
end
end
end
end
script.Parent.Touched:connect(onTouched)