I have accomplished getting the teleporter to work for all players, but I have not been able to specify which players it works for. When the game starts, a single player will receive a sword. The other players that have nothing in their backpacks or inventory should still be able to still use this teleporter, but once I attempt to specify the script to only work for them, it stops working. I tried using an "if and then" statement:
local place = CFrame.new(-20, 715, -100)
local swordcarrier = game.Players.Backpack:FindFirstChild("Sword") or game.Players.Character:FindFirstChild("Sword")
script.Parent.Touched:connect(function(p)
local humanoid = p.Parent:findFirstChild("Humanoid")
if (humanoid ~= nil) and not swordcarrier then
humanoid.Torso.CFrame = place
end
end)
There is only one error that comes up: Backpack is not a valid member of Players, but even after removing "game.Players.Backpack:FindFirstChild("Sword") or" from the script, the teleporter still doesn't for any players. It'll work if I remove the "and not swordcarrier". Thank you for the help in advance.
!!!!Big Thanks to Geobloxia Here is the fixed script. I don't know how to mark their comment as the answer so I just posted the corrected script here!!!!
local place = CFrame.new(-20, 715, -100)
script.Parent.Touched:connect(function(p)
local humanoid = p.Parent:findFirstChild("Humanoid")
if (humanoid ~= nil) then
local swordcarrier = game.Players:GetPlayerFromCharacter(p.Parent).Backpack:FindFirstChild("Sword") or game.Players:GetPlayerFromCharacter(p.Parent).Character:FindFirstChild("Sword")
if not swordcarrier then
humanoid.Torso.CFrame = place
end
end
end)

3 comments
game.Players is not the specific player. Use game.Players:GetPlayerFromCharacter(p.Parent)
when you define swordcarrier. Move swordcarrier to after if (humanoid ~= nil).
Thank you so very much Geobloxia . It works now!