I'm not a scripter myself, and can't script to save my life. But how would I make a teleporter that only teleports if you have the specific tool. If this is breaking any guidelines of this site, please let me know and i'll take it down. Thanks!
How would I create a teleporter that requires a tool?
2 answers
So let's put in the portal and a function that detects if a player touched it (the script's parent is the teleporter):
script.Parent.Touched:Connect(function(hit)
end)
But that function ONLY detects touches. So if another part randomly touches it, this function will activate too. SO let's add an if statement to detect if it's a player:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
end
end)
What I did is to verify if the hit's parent has a child called "Humanoid", because every Roblox characters have the child "Humanoid". ~= nil signifies "it's not not there" that is the same thing as "it's there" Now, let's detect if the player has the specific toll you told in the question:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
local player = game.Players:WaitForChild(hit.Parent.Name) -- getting the player
if player.Backpack:FindFirstChild("YOUR TOOL NAME HERE") ~= nil then
end
end
end)
At line 4, the script will verify if the player has the tool in his backpack. However, when the tool is equipped by the player, it will DISAPPEAR in player.Backpack and it will go in the player's inventory and if the players is unequipping it, it will go back in player.Backpack. But when the player touches the portal, we don't know if the player is equipping the tool or not. So let's add something at line 4:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
local player = game.Players:WaitForChild(hit.Parent.Name) -- getting the player
if player.Backpack:FindFirstChild("YOUR TOOL NAME HERE") ~= nil or hit.Parent:FindFirstChild("YOUR TOOL NAME HERE") ~= nil then
end
end
end)
Now let's add the teleporting script:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
local player = game.Players:WaitForChild(hit.Parent.Name) -- getting the player
if player.Backpack:FindFirstChild("YOUR TOOL NAME HERE") ~= nil or hit.Parent:FindFirstChild("YOUR TOOL NAME HERE") ~= nil then
player.Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace:WaitForChild(YOUR TELEPORT PART NAME HERE).Position)
end
end
end)
So that's it, but make sure to disable CANCOLLIDE, anchor the part and to put it a bit HIGHER to the ground, else the player will be stuck in the ground after teleporting. If you want the player to EQUIP the tool to teleport, delete line all the stuff BEFORE the "or" at line 4 and replace "or" by a "if".
You have to put this script in a script INSIDE the portal.
I hope this helped!
Depending on whether or not you want the tool to be equipped when using the teleporter, you would need to check either the players character, or the players backpack.
Example
If the tool needs to be equipped;
local plrService = game:GetService("Players")
local teleporter1 = script.Parent:FindFirstChild("Teleporter1")
local teleporter2 = script.Parent:FindFirstChild("Teleporter2")
local debounce = false
---------------------------------------------------------------------
local function searchbackpack(plr) -- function to do the searching. Keeps the script clean
for i, v in pairs(plr.Backpack:GetChildren()) do --looks at all the children under backpack.
if v:FindFirstChild("TeleporterKey") then --Finds a value object within the tool
if v:IsA("Tool") then --Checks if the child is indeed a Tool
return true --returns true and the script continues
end
end
end
end
---------------------------------------------------------------------
---------------------------------------------------------------------
teleporter1.Touched:Connect(function(hit)
if debounce == true then return end
local plr = plrService:GetPlayerFromCharacter(hit.Parent)
if not plr then return end
debounce = true
local success = searchbackpack(plr) --success will be set to true on line 12 if it passes all the checks.
if success then
plr.Character:MoveTo(teleporter2.Position)
end
wait(1)
debounce = false
end)
---------------------------------------------------------------------
You can search the backpack if the tool doesn't need to be equipped, else search the character of the player.
With any further help, my discord is; Despayr#2834
This discussion is preserved as it was. New answers, comments, and votes are closed.

8 comments
Question: What would be the script that the script you wrote goes into? Just a blank script?
Yes.
I don't really get it, I can't get it to work... Does the tool need to have collide on? Or am I messing something up?
The tool doesn"t need to collide on the part. When the PLAYER touches the part, it checks if the player has a tool in his backpack (not equipping) or in his character(equipping)
You should check those:
you have to put this in a SERVER SCRIPT in the PORTAL. If the portal is a MODEL, put this script in one of the PARTS in the model (I recommend the floor part)
only parts can detect the "Touched" function.
make sure the script is NOT DISABLED