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)
Ok, so I have made a script that you must copy and paste into the part and rename the entrance/exit part and the other entrance/exit part.
This might sound confusing but you will find out what I am saying after reading this....
Here is one of the scripts that needs to go into the original entrance part you will also need to rename the same part to "Door1"
script.Parent.Touched:connect(function(t) if t.Parent.Humanoid ~= nil then t.Parent.Torso.CFrame = script.Parent.Parent.Door2.CFrame end end)
So here I have a script that teleports the player to another part called "Door2" and thats pretty much it, there isnt really anything else to say.
This script needs to be placed in the part that is going to be the exit of the first part aka "Door1".
script.Parent.Touched:connect(function(t) if t.Parent.Humanoid ~= nil then t.Parent.Torso.CFrame = script.Parent.Parent.Door1.CFrame end end)
Basically this script is a return script to Door1, all that is changed is on line 4 from.
this
t.Parent.Torso.CFrame = script.Parent.Parent.Door2.CFrame
to this.
t.Parent.Torso.CFrame = script.Parent.Parent.Door1.CFrame
You will also need to rename the part to Door2 and you will be pretty much finished
With saying all that if you have problems with the entrance of the player you might want to change the part's properties to cancolide false.... other than that you should be fine..
If this helped you in any way... please accept this question.