The reason this doesn’t work is because you are attempting to tween a table, when instead you should be tweening the values inside the table. To do this, you’d get the parts using a for loop.
local TweenS = game:GetService("TweenService")
local TweenI = TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0)
local STWParts = script.Parent.ShadowTheWorld:GetChildren()
local function tweenParts(model, transparency)
for _, part in pairs(model:GetChildren()) do
if part:IsA("BasePart") then
TweenS:Create(part, TweenI, {Transparency = transparency}):Play()
end
end
end -- I Created a function that tweens the transparency of models
tweenParts(STWParts, 1) -- This is the STWAppear function
tweenParts(STWParts, 0) -- This is the STWDisappear Function
local TweenS = game:GetService("TweenService")
local TweenI = TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0)
local STWParts = script.Parent.ShadowTheWorld:GetChildren()
local function tweenParts(model, transparency)
for _,part in pairs(model:GetChildren()) do
if part:IsA("BasePart") or part:IsA("UnionOperation") or part:IsA("MeshPart") then
TweenS:Create(part, TweenI, {Transparency = transparency}):Play()
end
end
end
I apologize my script was incorrect because I called :GetChildren() Twice.
local TweenS = game:GetService("TweenService")
local TweenI = TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0)
local STWParts = script.Parent.ShadowTheWorld
local function tweenParts(model, transparency)
for _,part in pairs(model:GetChildren()) do
if part:IsA("BasePart") then
TweenS:Create(part, TweenI, {Transparency = transparency}):Play()
end
end
end
BTW :IsA(“BasePart”) Accounts for UnionOperations and MeshParts too