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

Why isn't my Lobby teleporting seated players to new place? Please help!

Asked by
JipSea 23
5 years ago
Edited 5 years ago

Hello, I am trying to make a Lobby game that teleports players who are seated into a new place, (Preferably a reserved server) Similar to Camping/Field Trip/High School games where players sit down in a vehicle and get teleported after a certain about of time to a Reserved/Private Server, This is what I have so far:

Seats.Touched:Connect(onTouched)
local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local Seats = script.Parent.Seats.Seat
local PlaceId = 000000000
local PlayerCount = 1

local PTable = {}

function onTouched(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        local player = Players:GetPlayerFromCharacter(hit.Parent)
if player then
        table.insert(PTable , player)
        if #PTable >= PlayerCount then
TeleportService:TeleportPartyAsync(PlaceId, PTable )
        end
end
end
end

Seats.Touched:Connect(onTouched)

I do not receive any errors, it just does not work. The place I want to teleport players to is a different created place. (I removed the PlaceId for this purpose)

Please help or point in the right direction!

I have read countless WIKI articles and still cannot get anything working.

Each Vehicle holds 9 seats. But I would like something that allows players to teleport to the new place once the first player sits down, like a timer would start, etc. so it doesn't have to necessarily be full.

Any help is appreciated- At this point I am fine with ditching the "seat" concept and just going with a pad they step on that queues them and teleports after a short time.

What am I doing wrong?

Answer this question