Hi there! I’m trying to tween the player’s body parts to be invisible, then back to being visible but I ran into an issue, some decals/textures on the player dont have 0 transparency. How could I write a variable that holds the original transparency values so I dont have to tween each one separately.
I’ve looked through some topics and did a couple of things but nothing has worked so far, all help would be appreciated.
If you’re wanting to tween all the players body parts to be invisible you could use a for loop through all of the parts and check if they’re a BasePart and tween their transparency.
Example script:
local TweenService = game:GetService("TweenService")
for i, part in pairs(character:GetChildren()) do -- Get all instances inside the player model
if part:IsA("BasePart") then -- Check if its a BasePart
TweenService:Create(part, TweenInfo.new(.25, Enum.EasingStyle.Quad), {Transparency = 1}):Play() -- Play the tween so it becomes invisible
end
end
local currentTransparencies = {}
local function saveTransparencies(player)
local character = player.Character
currentTransparencies[player] = {}
for _, descendant in ipairs(character:GetDescendants()) do
if descendant:IsA("BasePart") or descendant:IsA("Decal") then
currentTransparencies[player][descendant.Name] = descendant.Transparency
end
end
end
local function loadTransparencies(player)
local character = player.Character
for instanceName, transparencyValue in pairs(currentTransparencies[player]) do
local instance = character:FindFirstChild(instanceName, true)
if instance then
instance.Transparency = transparencyValue
end
end
end
Here’s an approach to solve this problem, you’d need to implement the tweening.