How would I go about getting every part in a tool? For my animation to look a bit better, I want the weapon to be invisible, until it is at the point where the weapon is held. For that I decided on using some animation events, and then turning it transparent at the event, and visible again at the 2nd event. However, there are accesories that are still visible during the transparent part, and for that how would I get all the parts inside of the tool, so I can turn it all invisible?
Code
local tool = script.Parent
local Idle = Instance.new("Animation")
local Equip = Instance.new("Animation")
local Swing = Instance.new("Animation")
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local handle = tool.Handle
Idle.Name = "IdleAnim"
Idle.AnimationId = "rbxassetid://10662611565" -- Idle animaton ID here
Equip.Name = "EquipAnim"
Equip.AnimationId = "rbxassetid://10723444666" -- Idle animaton ID here
Swing.Name = "SwingAnim"
Swing.AnimationId = "rbxassetid://10662345775" -- Idle animaton ID here
local children = tool.Handle:GetChildren()
local track
tool.Equipped:Connect(function()
track = humanoid:LoadAnimation(Equip)
track.Priority = Enum.AnimationPriority.Action
track:Play()
track:GetMarkerReachedSignal("Invisible"):Connect(function()
-- tool.Handle.Transparency = 1
-- tool.Handle.CanCollide = false
end)
track:GetMarkerReachedSignal("Visible"):Connect(function()
tool.Handle.Transparency = 0
tool.Handle.CanCollide = true
end)
track.Stopped:Wait()
track = humanoid:LoadAnimation(Idle)
track.Priority = Enum.AnimationPriority.Action2
track:Play()
end)
tool.Unequipped:Connect(function()
if track then
track:Stop()
end
end)
The tool in the explorer expanded:
The tool in the workspace: