I’m trying to recreate a game somewhat like Iron Man simulator but with the moves I want and I just finished the call suit function and when I morph into the suit the suit doesnt have any animations. If there is any better way to do this I would appreciate any suggestions.
local ReplicatedStorage = game.ReplicatedStorage
local Assets = ReplicatedStorage.Assets
local TweenService = game:GetService("TweenService")
local EquipTime = 1
return function(Char:Model,Suit:string)
if Char then
local AnimationModule = require(Char.Core.Animations)
local ChosenSuit = nil
for Index,Value in game.ReplicatedStorage.Assets.Suits:GetChildren() do
if string.lower(Value.Name) == Suit then
ChosenSuit = Value
break
end
end
if ChosenSuit then
local SuitClone : Model = ChosenSuit:Clone()
SuitClone.Parent = workspace.Suits
TweenService:Create(SuitClone.PrimaryPart,TweenInfo.new(1),{CFrame = Char.PrimaryPart.CFrame * CFrame.new(0,5,2.5)}):Play()
task.wait(1)
TweenService:Create(SuitClone.PrimaryPart,TweenInfo.new(1),{CFrame = Char.PrimaryPart.CFrame * CFrame.new(0,0,2.5)}):Play()
task.wait(1)
AnimationModule.Animations["SuitUp"]:Play()
local CharHum : Humanoid = Char.Humanoid
local Player = game.Players:GetPlayerFromCharacter(Char)
local Hum : Humanoid = SuitClone:WaitForChild("Humanoid")
local Animator : Animator = Hum:WaitForChild("Animator")
local SuitHrp : Part = SuitClone.PrimaryPart
local Animation : AnimationTrack = Animator:LoadAnimation(Assets.Animations.SuitUp)
Animation:Play()
Assets.Remotes.LockPlayer:FireClient(Player,Animation.Length+EquipTime*2,true)
task.wait(EquipTime)
local Tween = TweenService:Create(SuitHrp,TweenInfo.new(EquipTime),{CFrame = Char.PrimaryPart.CFrame})
Tween:Play()
task.wait()
Tween.Completed:Once(function()
for _,object : Instance in SuitClone:GetChildren() do
if object:IsA("BasePart") or object:IsA("MeshPart") then
object:SetNetworkOwner(Player)
end
end
Player.Character = SuitClone
Assets.Remotes.LockPlayer:FireClient(Player,0,false,SuitClone)
end)
end
end
end