I’m trying to make a billboard gui that appears on all players apart from yourself. I have to put the billboard gui into the playergui for the image buttons to work. I have wrote some code for this but it only applies the billboard gui to 1 of the players and for some players it doesn’t show the billboard gui at all.
Here is an example from the image below:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local replicatedStorage = game:GetService("ReplicatedStorage")
local muteGui = replicatedStorage.muteGui
local function OnCharacter(Character)
local playerGui = player:WaitForChild("PlayerGui")
muteGui:Clone()
muteGui.Parent = playerGui
local frame = muteGui.Frame
frame.Visible = true
local UpperTorso = Character:WaitForChild("UpperTorso")
muteGui.Adornee = UpperTorso
end
local function OnPlayer(Player)
if Player ~= player then
if Player.Character then
OnCharacter(Player.Character)
end
Player.CharacterAdded:Connect(OnCharacter)
end
end
for i, Player in pairs(Players:GetPlayers()) do
OnPlayer(Player)
end
The reason it only appears once is because when you are checking for a new player, you only checked once
Here, you didn’t clone properly. What the script is reading is that it parents the muteGui (which is in RS) to the player who first joins, so there’s no more GUI to clone to the rest of the players.
Your code is also unnecessarily complicated, I’ve simplified it
You can put this in StarterCharacterScripts
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild('PlayerGui')
local muteGui = game.ReplicatedStorage:WaitForChild('muteGui')
local muteGuiClone = muteGui:Clone()
local frame = muteGuiClone.Frame
muteGuiClone.Parent = PlayerGui -- Parents the CLONE to the player's PlayerGui
frame.Visible = true
Also is there a reason you’re setting the Adornee to the Player’s UpperTorso?
I want the billboard gui to be on their torsos because im making a button to mute a single player instead of muting all the players. That’s also why I think ill need the if statement to stop the player playing the game receiving the mute button on their torso