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

How do I make pressure plate with GUI that shows how many players are on it?

Asked by 6 years ago

It needs to be filtering enabled too and work with non-FE.

1 answer

Log in to vote
0
Answered by 6 years ago

You can do something like this: (I did not test this but I figure you can probably fix it if there are mistakes.)

On Server Script

local playersTouching = 0
local part = ...
local remoteEvent = ...

part.Touched:Connect(function()
    playersTouching = playersTouching + 1
    remoteEvent:FireAllClients(playersTouching)
end)

part.TouchEnded:Connect(function() 
    playersTouching = playersTouching - 1
    remoteEvent:FireAllClients(playersTouching)
end)

On Client Script

local remoteEvent = ...
local textLabel = ...

remoteEvent.OnClientEvent:Connect(function(value)
    textLabel.Text = 'There is '..value..' much people touching this part'
end)
0
Where would I put the local script? I have an idea but I'm not exactly sure. Lengthtracked 5 — 6y
0
Put the local script in StarterGui, and make sure to change local textLabel = ... to where the textlabel is ray2597 0 — 6y
Ad

Answer this question