Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 answer

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)

2 comments

0

Where would I put the local script? I have an idea but I'm not exactly sure.

0

Put the local script in StarterGui, and make sure to change local textLabel = ... to where the textlabel is

This discussion is preserved as it was. New answers, comments, and votes are closed.