Transparency wont work?

im making a fancy teleporting script

For some reason, the humanoid root part wont go back to being transparent

heres the code

Code
local bool = {}
local TS = game:FindService("TweenService") or game:GetService("TweenService")

local goal = {}
goal.Transparency = 1

local goal2	= {}
goal2.Transparency = 1

local goal3	= {}
goal3.Transparency = 0



event.OnServerEvent:Connect(function(plr, MPos)
	if not table.find(bool, plr) then
		table.insert(bool, plr)
		local char = plr.Character
		local rootPart = char.HumanoidRootPart
		local rootPos = rootPart.Position
		
		local magnitude = (rootPos - MPos).Magnitude
		-----------
		if magnitude >= 100 then return end
		-----------
		print(magnitude)
		local BV = Instance.new("BodyVelocity")
		BV.Parent = rootPart
		BV.MaxForce = Vector3.new(999999999999999999,999999999999999999,999999999999999999)
		BV.Velocity =	rootPart.Position +	Vector3.new(100,0,0)
		task.wait(.001)
		BV.Velocity = Vector3.new(-100,0,0)
		task.wait(.001)
		
		for i, v in pairs(char:GetChildren()) do
			if v:IsA("BasePart") then
				print(v)
				local tween = TS:Create(v, TweenInfo.new(.2), goal)
				tween:Play()
			end
			
			if v:IsA("Accessory") then
				local tween = TS:Create(v.Handle, TweenInfo.new(.2), goal2)
				tween:Play()
			end
		end
		BV:Destroy()
		task.wait(.01)
		for i, v in pairs(char:GetChildren()) do
			if v:IsA("BasePart") then
				print(v)
				local tween = TS:Create(v, TweenInfo.new(.2), goal3)
				tween:Play()
				if  v.Name == "HumanoidRootPart" then
					v.Transparency = 1
				end
				
			end

			if v:IsA("Accessory") then
				local tween = TS:Create(v.Handle, TweenInfo.new(.2), goal3)
				tween:Play()
			end
		end
		rootPart.Position = MPos

		task.wait(.01)
				
		local index = table.find(bool, plr)
		if index then 
			table.remove(bool, index)
		end
	end
end)

Im not sure why it wont go back to being transparent even tho i already set it in the script, so help is appreciated :grinning: thank you for your time

You should check if the name of the part is HumanoidRootPart in the same line as you check if it’s a BasePart. Doing this will prevent the tween from making the root part non-transparent in the first place.

if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then
	local tween = TS:Create(v, TweenInfo.new(.2), goal3)
	tween:Play()
end