As showed in this video: SupportAnimationHelp
My Gun Model located at Workspace, has animation and it works fine. but
The Second one located at a folder FX also in the Workspace. has animation, plays the animation but no visualization of the animation.
Notes:
The working script is a server-script and, the second which creates the model is a local script
both Models has Animation Controllers
Animation Priority is set to Action
Script:
local Rs = game:GetService(“ReplicatedStorage”)
local Players = game:GetService(“Players”)
local Ts = game:GetService(“TweenService”)
local InputService = game:GetService(“UserInputService”)
local RunService = game:GetService(“RunService”)
local Resources = Rs.Guns.GunZ
local Player = game.Players.LocalPlayer
local Char = script.Parent
local Hum = Char.Humanoid
local HumR = Char.HumanoidRootPart
local Anims = { Out = “rbxassetid://11943590590”,
In = “rbxassetid://11943586859”}
local model = nil
local function setUp (Character)
local handle = Resources.Handle:Clone()
handle.Parent = Char
local md6 = Instance.new(“Motor6D”, handle)
md6.Part0 = Char.RightHand
md6.Part1 = handle
md6.C1 = CFrame.new(0,0,0)
model = Resources.GunZModel:Clone()
local weldpart = model.ZGunBase
model.Parent = workspace.Fx
local weld = Instance.new(“Weld”, weldpart)
weld.Part0 = handle
weld.Part1 = weldpart
weld.C1 = CFrame.new(0,-0.3,0) * CFrame.Angles(math.rad(90),0,math.rad(0))
end
for a,b in pairs(Players:GetChildren()) do
repeat task.wait() until b.Character
setUp(b.Character)
b.CharacterAdded:Connect(function(Char)
Char:WaitForChild(“RightHand”)
setUp(Char)
end)
end
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Char)
Char:WaitForChild(“RightHand”)
setUp(Char)
end)
end)
local Anim = model:WaitForChild(“Animation”)
local AnimControl = model:WaitForChild(“AnimationController”)
local Lights = {model.LeftArmTopBack.Light, model.RightArmTopBack.Light, model.LeftArmTopFront.Light, model.RightArmTopFront.Light,
model.LeftArmBottomBack.Light, model.RightArmBottomBack.Light, model.LeftArmBottomFront.Light, model.RightArmBottomFront.Light}
local Activated = false
local TsInfo = TweenInfo.new(0.2,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,true,0)
–[[ for i, v in pairs(Lights) do
local TweenLight = Ts:Create(v,TsInfo,{Color = Color3.fromRGB(138, 197, 255)}):Play()
end]]
InputService.InputBegan:Connect(function(Input, GPE)
if not GPE then
if Input.UserInputType == Enum.UserInputType.MouseButton1 then
if Activated == false then
Anim.AnimationId = Anims.Out
local AnimTrack = AnimControl:LoadAnimation(Anim)
AnimTrack:Play()
AnimTrack:AdjustSpeed(0.1)
print(AnimTrack.Length)
end
end
end
end)
Any help is appreciated,
EcosKorpion