Detect Players System

Hello, Developers!

I’m trying to do an “Detect System” when a player clicks a UI button it clones an billboard gui with frame in it from workspace in to other players and only the player that clicked the UI button will see the billboard gui in other players. I tried searching and I couldn’t find anything.

I also have an folder in workspace that if the round starts the player will be parented to the folder.
The script:

local players = game.Workspace.GameSystem.PlayersInGame.Survivor
local Button = script.Parent
local Used = false

Button.MouseButton1Click:Connect(function()
	if Used == false then
		for i, plrs in ipairs(players:GetChildren()) do
			if plrs.Name ~= game.Players.LocalPlayer.Name then
				Used = true
			local particles2 = Instance.new("BillboardGui")
			particles2.Size = UDim2.new(6,0,6,0) --[The Size You Want Your BillBoard To Be]--
			particles2.AlwaysOnTop = true
			local particles = workspace.BillboardGui.ImageLabel:Clone()

			particles.Parent = particles2

			particles2.Parent = plrs.UpperTorso
			wait(10)
			particles2:Destroy()
			wait(120)
			Used = false
			end
		end
	end
end)
1 Like

You would have to do all this in a local script so only the player who clicked sees it

Yes I already tried it but it doesn’t works.

Nevermind, I fixed it by myself. :slight_smile:

That’s not going to work as you’re only cloning it once and not for each player.

Hmmm yes, how should I do that then? @LordMerc

try this on a localscript:

local player = game.Players:GetChildren()
local Button = script.Parent

Button.MouseButton1Click:Connect(function()

for i, plrs in ipairs(player) do
	if plrs.Name ~= game.Players.LocalPlayer.Name then
		local particles2 = Instance.new("BillBoardGui")
		particles2.Size = UDim2.new() --[The Size You Want Your BillBoard To Be]--
			particles2.AlwaysOnTop = true
		local particles = workspace.BillBoardGui.ImageLabel:Clone()
		
		particles.ImageTransparency = 1
		particles.Parent = particles2
		
		particles2.Parent = plrs.Character.Head
		local ts = game:GetService("TweenService")
		local ti = TweenInfo.new(
			5, --Time--
			Enum.EasingStyle.Linear, --Easing Style--
			Enum.EasingDirection.Out, --EasingDirection--
			0, --Repeat Count--
			false --Repeats?--
		)
		local t = ts:Create(particles, ti, {ImageTransparency = 0})
			t:Play()
	end
end

end)

1 Like

No that’s not what I want to do, I want to copy billboard gui from workspace to all other players in the In-Game folder if the button is clicked, and the player that clicked the button can only see the billboard gui.

its what the code does, if you clone it you’ll have positioning issues thats why I used Instance.new

The billboard gui is already positioned.

thats why you have to create it instead of clonning it

I’ll try it again and I will tell you if it works or not. Because it didn’t worked for me the first time.

1 Like

Well if it didn’t work for you the first time it’s not going to work for you a second time.

Programming is black and white, it either works or it doesn’t, no inbetween.

It works but it only copies the billboard gui in to only 1 player and not all the players.
I customized the script:

local player = game.Workspace.GameSystem.PlayersInGame.Survivor
local Button = script.Parent
local Used = false

Button.MouseButton1Click:Connect(function()
	if Used == false then
		for i, plrs in ipairs(player:GetChildren()) do
			if plrs.Name ~= game.Players.LocalPlayer.Name then
			Used = true
			local particles2 = Instance.new("BillboardGui")
			particles2.Size = UDim2.new(6,0,6,0) --[The Size You Want Your BillBoard To Be]--
			particles2.AlwaysOnTop = true
			local particles = workspace.BillboardGui.ImageLabel:Clone()

			particles.Parent = particles2

			particles2.Parent = plrs.UpperTorso
			wait(10)
			particles2:Destroy()
			wait(120)
			Used = false
			end
		end
	end
end)

are you using tweenservice to animate transparency?

you could add this:

local ts = game:GetService(“TweenService”)
local ti = TweenInfo.new(
5, --Time–
Enum.EasingStyle.Linear, --Easing Style–
Enum.EasingDirection.Out, --EasingDirection–
0, --Repeat Count–
false --Repeats?–
)
local t = ts:Create(particles, ti, {ImageTransparency = 0})
t:Play()
t.Completed:Wait()
particles:Destroy()

No i don’t want to animate the transparency.

I want the billboard gui to be created inside all players not just 1, the script that you send me creates the billboard gui in only 1 player and not all the players.

are you testing it with 2 or more players?

I test it with 2 players only, do i need more players?

thats why, the code I sent you creates a billboard for all the players except for you