#Can someone tell me what's wrong

3 messages · Page 1 of 1 (latest)

fallen citrus
#
local teleportService = game:GetService("TeleportService")
local elevator = script.Parent.Parent.Parent.Elevator
local part = script.Parent
local reservedId = teleportService:ReserveServer(14145043523)
local placeID = 14145043523
local text = elevator.tpPart.BillboardGui.TextLabel
local queue = {}

while wait() do
    if #queue == 4 then
        part.CanTouch = false
    end
end

while #queue >= 1 do
    for i = 1, 10, 1 do
        text.Text = tostring(i)
        if i == 10 then
            teleportService:TeleportToPrivateServer(placeID, reservedId, queue)
        end
        wait(1)
    end
end


part.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") and players:GetPlayerFromCharacter(hit.Parent) then
        local plr = players:GetPlayerFromCharacter(hit.Parent)
        local char = plr.Character or plr.CharacterAdded:Wait()
        if table.find(queue, plr.UserId) then
            print("Player is already in queue!")
        else
            table.insert(queue, plr.UserId)
            char:WaitForChild("HumanoidRootPart").CFrame = elevator.tpPart.CFrame
            game.ReplicatedStorage.Camera:FireClient(plr)
        end
    end
end)```

There's a problem with the text, and the teleport, output doesn't show anything, I believe the only things that don't work are the while and for loops, I can't figure out the problem so pls help
obtuse quest
#

im pretty sure while wait() do stops the rest of your script from running

#

use RunService