Hello! So i am trying to make a code so that when the character teleports, their transparency fades out for a few seconds, then comes back. I am trying to tween the players transparency in player visiblity so it smoothly goes from 0-1-0, im super new to coding so bare with me. I want it to be connected to the teleport function like the other tweens so when you press the keybind it all happens at once, any help on what im doing wrong? or what i should do? Please and thank you! I've been looking all day. (note i just cut off the other codes for the tweens, i just copied the player visiblity cause its what im struggling with)
~~~~~~~~~~~~~~~~~
-- PLAYER VISIBLITY --
local player = game:GetService("Players").LocalPlayer
local char = player.Character
local children = char:GetChildren()
local trtweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local trtween = game:GetService("TweenService")
for i, child in ipairs(children) do
if child:IsA("BasePart") or child:IsA("MeshPart") then
if child.Transparency == 0 then
trtween:Create(child, trtweenInfo, {Transparency = 1,0}):Play()
end
end
end
-- TELEPORTATION -- these can be used on their owns individually
wait()
local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()
local Range = 300
Mouse.KeyDown:Connect(function(key)
local MousePosition = Mouse.Hit.Position
local Distance = (Player.Character.Head.Position - MousePosition).Magnitude
if key == "t" and Distance <= Range then
print("T was pressed")
Tween:Play()
TweenLight:Play()
wait(1)
Player.Character:MoveTo(MousePosition)
Regular:Play()
TweenLightDef:Play()
end
end)
~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~

1 comment
Ah okay, thank you! If i wanted to turn it into a keybind how would i? when i try to do "trtween:play()" the ":play()" doesnt show up. I tried turning the trtween into a variable like "local transparent tween = trtween:Create(child, trtweenInfo, {Transparency = 1}):Play()" but it still doesn't show up when i try to play it. This only happens when i try to play it on a line separate from the trtwee