My purpose for this is that I've been trying to make a two way teleport pad. So far, I've made no progress than this so far. No errors, just it doesn't work.
Debounce = false
B = script.Parent.Parent.B
Working = script.Parent.Enabled
WorkingB = B.Enabled
script.Parent.Parent.A.Touched:connect(function(Hit)
if not Debounce and Working == true then
Debounce = true
Working.Value = false
WorkingB.Value = false
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
local Humanoid = Hit.Parent:FindFirstChild('Humanoid')
local Character = Player.Character
local Torso = Character:FindFirstChild('Torso')
-- Character
for i,v in pairs(Character:GetChildren()) do
if v:IsA('Part') then
for i = 0,1,.2 do
v.Transparency = i
Torso.Anchored = true
wait(.0001)
end
end
end
-- Hats
for i,v in pairs(Character:GetChildren()) do
if v:IsA('Hat') then
v:FindFirstChild('Handle')
for i = 0,1,.2 do
v.Handle.Transparency = i
wait(.0001)
end
end
end
-- Teleports
Torso.CFrame = B.CFrame * CFrame.new(0,3,0)
-- Hat 2
for i,v in pairs(Character:GetChildren()) do
if v:IsA('Hat') then
v:FindFirstChild('Handle')
for i = 1,0,-.2 do
v.Handle.Transparency = i
wait(.0001)
end
end
end
-- Character 2
for i,v in pairs(Character:GetChildren()) do
if v:IsA('Part') then
for i = 1,0,-.2 do
v.Transparency = i
Character.HumanoidRootPart.Transparency = 1
Torso.Anchored = false
wait(.0001)
end
end
end
end
wait(5)
Debounce = false
Working.Value = true
WorkingB.Value = true
end)

2 comments
You should probably combine all of your for i, v statements and see if that helps
They are all scanning the pair Character:GetChildren() after all