How do I create a text label that can show the players inside my multi-place game

I have been trying to find someone who can help me with the problem for 5 months…

@3spigs
Put this inside the ScreenGui

LocalPlayer = game.Players.LocalPlayer
Player = game:GetService("Players"):GetPlayers()


script.Parent.TextLabel.Text = tostring(table.unpack(Player))
1 Like

I mean by the players on the other game of mine. Multi-place game can be located in asset manager. I don’t need the inside game text label.

Try request players from another places using MessagingService

1 Like

Maybe I could try learning how to use MessagingService thanks!

Here is my code:

local placeId = 1

local Player = game:GetService("Players")
local RunService = game:GetService("RunService")

local currentPlace = game.Workspace["Place "..placeId]
local nextPlace = game.Workspace["Place "..(placeId+1)]

while wait(1) do
    local players = Player:GetPlayers()
    local count = 0
    for _, player in ipairs(players) do
        if player.Character and player.Character:FindFirstChild("HumanoidRootPart") and player.Character.HumanoidRootPart.Position.Z <= currentPlace.CFrame.p.Z and player.Character.HumanoidRootPart.Position.Z > nextPlace.CFrame.p.Z then
            count = count + 1
        end
    end
    print("There are "..count.." players in this place")
end

However, it only prints to the console. How do I show it to the players?

A:

You’ll have to create a TextLabel or a TextButton for each player, then update the Text property each time the count changes.
local textLabel = script.Parent:WaitForChild(“TextLabel”)

while true do
    local count = Player.GetPlayerCount()
    textLabel.Text = "There are " .. count .. " players in this place"
    wait(1)
end

(There’s no reason to have a for loop and iterate over every player’s character when you’re just checking how many players are present.)
I quickly flew over the code

1 Like

There is one problem… The script wont work because of the “<=” in the script sadly

OH wait nevermind I fixed it. Just found out what to do

1 Like