Hi Im Using a piece of code and trying to tween transparency of a part, when I run the code it waites for a second then sets transparency to 1 instead of tweening it I can tween things like cframes etc. but it rejects tweening transparency, why?
Iām taking a complete guess here, so idk.
I tried the script on itās own in a blank studio, defining āHitā as a part in the workspace. So in my case, the tween is set to run instantly as soon as the game starts. If that is the same in your case, then I managed to make the tween show up by either 1) changing TweenInfo.new(1) to a higher value, like 5 or 2) adding wait(1) before the tween.
If thatās not the case, then perhaps something else in the script is causing the tween to not run correctly?
Pretty sure it has nothing to do with that since it has a wait before but still I did tried that before and no difference it just waits X amount of time and sets transparency to 1 like it does rn
Update: I did a small test and it turns out it does work with other parts but its not working for the part āHitā I donāt know why since it literally has the same properties
Problem would be that youāre not referencing the part inside the script, Keep in mind that itās best to Create variables for it first and never add it directly without creating it (you mightāve heard with "Unknown Global āHitā ")
local Hit = script.Parent
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingDirection.Out, Enum.EasingStyle.Linear) --You don't need 2 of enums, keep it or remove it as you want
local TweenSet = TweenService:Create(Hit, tweenInfo, {Transparency = 1})
TweenSet:Play()
Have you tested on both client and server? Maybe thereās a replication issue / it is client sided
Also this has nothing to do, but although Lua accepts defining names in dictionaries like variables, you shouldnt do that, instead, for your muscle memory, use [""], because the other way around the script can confuse it with other variables etc