Why does this tween line of code not work?

I’m trying to tween the transparency of a model with one part in it with this line local NonTransparentTween = TweenService:Create(Helmet,TweenInfo.new(Time),{Transparency = 0}) but I get the error: "TweenService:Create no property named ‘Transparency’ for object ‘Model’ "
I tried adding Model.Part.Transparency to get the basepart but it ain’t working, what’s the issue and how do I fix it?

You need to include all the information for a Tween

local TweenService = game:GetService("TweenService")
local PrimaryPart = game.Workspace.Model.Part    

local goal = {}
goal.Transparency = 0

local TweenInformation = TweenInfo.new(
    3, --duration
    Enum.EasingStyle.Quart, --Type of Style
    Enum.EasingDirection.Out, --Direction/In or Out?
    0, --number of repeats
    false, --will the tween repeat?
    0 --delay between each tween
)

local tween = TweenService:Create(PrimaryPart, TweenInformation, goal)
tween:Play()
1 Like

I did, the problem just lies in the transparency goal that I’m trying to tween.

1 Like

This is the error I get TweenService:Create no property named 'Transparency' for object 'WorkingHelmet'

1 Like

Oops, I just saw this article

Turns out you can’t tween Transparency

1 Like

Look into this article How would I tween transparency? - #2 by starmaq

If it still doesn’t work, maybe because Transparency is not a member of Helmet

1 Like

if your trying to tween transparency use a for loop

for i=0,1,.001 do
part.Transpareny = i
end

this might not be right for a loop but its about what your looking for

1 Like

Yeah I read it that’s how I got the idea of doing this in the first place.

It says you’re trying to tween a model, not a basepart.

I am trying to tween the model

The best way to do this would probably to do this:

for _,part in pairs(model:GetDescendants()) do
     if part:IsA("BasePart") do
          spawn(function()
               for i = 0,1,0.05 do
                    part.Transparency = i
                    wait()
              end
          end)
     end
end

Read your errors carefully and properly. It’s a literal wording: Models don’t have a Transparency property. Tweens operate on a single instance, not its descendants. You have to manually tween the Transparency of descending BaseParts if you want your desired effect.

1 Like

I recognised that Models don’t have a transparency property, I also did add

Do you have an alternative to fixing this?

If you don’t provide detailed information to work off of, it’s not easy to give you any help. The only error you’ve given is when you try to tween a nonexistent property on a Model instance, but I don’t know what happens when you add “Model.Part.Transparency” because you haven’t provided an error log for that. That being said, this would also be incorrect if you’re passing it as the first argument of Create because it should be an instance, not a property. “Model.Part” would be more acceptable to go off of.

alright I’ll give that a shot.

for anyone reading this in the future, this is not correct. TweenInfos do not need all of their parameters set, thats what default values are for.

1 Like

That’s 100% fake. TweenService can tween numbers as well.

1 Like

If you’re trying to make an entire model with tweening, use this.

for i,v in pairs(script.Parent:GetDescendants()) do

    local NonTransparentTween = TweenService:Create(Helmet,TweenInfo.new(Time),{Transparency = 0})

end