Recently I have been trying to make a billboard gui appear on all the players in the game but yourself to make it so the players can simply click on the player they want to mute. Because the billboard gui has buttons on, it needs to be in the PlayerGui, therefore I need to adornee a different billboard gui to all the players UpperTorso’s.
I have tried many different approaches to this, such as remote events, and looping through all the players in a local script to asign the billboard gui to the different players. However whenever I test it there are always a few players without anything asigned to them.
The closest I have got to this working was with a remote event. When testing with 8 players in studio, 2/8 players had no issues but the other 6 clients had 1 player without a billboard gui asigned to them, instead the gui that was supposed to be on the player was located in the middle of the baseplate.
this is the code I used:
Code
Server Script:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local individualMute = ReplicatedStorage:WaitForChild("individualMute")
local function onPlayerAdded(player)
individualMute:FireAllClients(player)
end
Players.PlayerAdded:Connect(onPlayerAdded)
Local Script:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local playerGui = player.PlayerGui
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local individualMute = ReplicatedStorage:WaitForChild("individualMute")
local muteGui = ReplicatedStorage:WaitForChild("muteGui")
local muteGuiFolder = playerGui:WaitForChild("individualMute")
local function onInduvidualMute()
for i, otherPlayers in pairs(Players:GetChildren()) do
if otherPlayers ~= player then
local muteGuiClone = muteGui:Clone()
muteGuiClone.Name = otherPlayers.Name
muteGuiClone.Frame.Visible = true
muteGuiClone.Parent = muteGuiFolder
local character = otherPlayers.Character
if not character or not character.Parent then
character = player.CharacterAdded:wait()
end
muteGuiClone.Adornee = character.UpperTorso
end
end
end
individualMute.OnClientEvent:Connect(onInduvidualMute)
I’m not sure if I’m going about this right, and if there would be a better approach to this problem.