Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does it teleport players who have not touched the object?

Asked by
uhjos_h 19
3 years ago
local boat = game.Workspace.movingboat.MovingModel
local TeleportService = game:GetService("TeleportService")
local code = TeleportService:ReserveServer(6597645798)

local placeId = 6597645798

local function onPartTouch(otherPart)
    local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)
    local players = game.Players:GetChildren()
    if #players >= 4 then
        wait(5)
        TeleportService:TeleportToPrivateServer(placeId, code, players)
    end
end
script.Parent.Touched:Connect(onPartTouch)

Help, lol. It seems if there is 4 people in the server, it will teleport all the players even if they have not touched the desired part.

1 answer

Log in to vote
0
Answered by 3 years ago

It is because you sent "Players"

That will teleport all the players in the server.

Instead, send just player. Get rid of the s

:)

Ad

Answer this question