I have a teleporting script and a part that detects if it got touched by a player and teleports the player that touched it. But it's not working as it's supposed to. It's teleporting ALL players. Even players that hasn't even touched it.
The script looks something like this but it's not the real script.
part.Touched:Connect(function(p) local plr = game.Players:GetPlayerFromCharacter(p.Parent) if plr ~= nil then player.Character.Humanoid.Torso.CFrame = CFrame.new(206.25, -159.5, -1833) end end)
part.Touched:connect(function(hit) if hit then if hit.Parent:FindFirstChild('Humanoid') and game.Players:FindFirstChild(hit.Parent.Name) then local player = game.Players:FindFirstChild(hit.Parent.Name) player.Character.HumanoidRootPart.CFrame = CFrame.new(206.25, -159.5, -1833) -- paste the position you want the player to teleport to here end end end)