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

How to make a sign that shows all the players on a part?

Asked by 4 years ago

Hello everyone. I'm currently working on a game inspired by Flicker and Murder Island 2 and I was wondering how to make something like this. Thanks.

0
flicker mystery 2 xd greatneil80 2647 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You can add a SurfaceGui to display the player names.

Sample Code:

local playersService = game:GetService("Players")

local text = ""
local part = workspace.ToTouchPart

part.Touched:Connect(function(gotPart)
    if playersService:GetPlayerFromCharacter(gotPart.Parent) then
        for _, player in pairs(playersService:GetPlayers()) do
            text = text.." "..player.Name
        end
    end
end)
0
Thanks, but how do I make it appear when I touch a part? Algometry 6 — 4y
0
Code has been updated. fixmycode 86 — 4y
0
Why use playerservice when you can just check for a humanoid? RunKittenzRComin 170 — 4y
0
It's a good practice, especially since it's just for players, not NPC's. fixmycode 86 — 4y
Ad

Answer this question