UI is not updating for all the Clients. RemoteEvents issue..?

He fires a RemotEvent to all clients. It’s like looping and running the code through each client. I am not quite sure if it could be the problem, but it may be.

You can use only a ServerScript by changing your ServerScript code to this:

local RS = game:GetService("ReplicatedStorage")
local UI = RS:FindFirstChild("UI")
local VotingTime = RS:FindFirstChild("VotingTime")

local RemoteEvent = RS:FindFirstChild("RemoteEvent")

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		UI:Clone().Parent = player.PlayerGui
		player.PlayerGui.UI.Adornee = character.Head
		
		VotingTime.Changed:Connect(function()
		
			for _, v in ipairs(game.Players:GetChildren()) do
				
				if v:IsA("Player") and not v == nil then
					
					local playerGui = v.PlayerGui
					
					playerGui.ScreenGui.Frame.Visible = true -- Reference your UI.
				end
			end
		end)
	end)
end)

Unfortunately now it doesn’t seem to be working at all.

I’m looking at the PlayerGui while the game is running and now the Main frame isn’t being toggled at all.

I figured this too, but apparently when attempting this with a Server script, it gives no result. In fact, I’m pretty sure it breaks it altogether, because the Main frame is no longer toggling.

Did you reference your UI where I commented?

You have to toggle it for every player. Iterate over the current players in game, go into their PlayerGui and set the visibility to true.

1 Like

@Blunce @XDvvvDX I have iterated through all of the PlayerGuis, it fixes it halfway, but only returns back to square one where only the Client can see the change.

Script:

local RS = game:GetService("ReplicatedStorage")
local UI = RS:FindFirstChild("UI")
local VotingTime = RS:FindFirstChild("VotingTime")


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		UI:Clone().Parent = player.PlayerGui
		player.PlayerGui.UI.Adornee = character.Head
		
		VotingTime.Changed:Connect(function()
			if VotingTime.Value == true then
				for _, v in ipairs(game.Players:GetChildren()) do
					if v:IsA("Player") and v ~= nil then
						local playerGui = v.PlayerGui
						playerGui.UI.Main.Visible = true -- Reference your UI.
					end
				end
			else
				for _, v in ipairs(game.Players:GetChildren()) do
					if v:IsA("Player") and v ~= nil then
						local playerGui = v.PlayerGui
						playerGui.UI.Main.Visible = false -- Reference your UI.
					end
				end
			end
		end)
	end)
end)

I’m really scratching my head with this one because I have no idea what it can possibly be. I can activate and uncopylock this place if that helps.

2 Likes

Yes, please do I would like to see the code.

1 Like

Is the output returning anything?

Can you please explain to me what is supposed to happen and what in the game is happening?

Okay, so you should probably not put the billboard gui on the playergui, instead you could put it somewhere on a part above the person so that it could be manipulated

Absolutely.

I’m creating a concept where every it is time to vote, each player has a suspicion meter. Hence, the billboardguis. So the system goes as this:

  • Server script in the ServerScriptService is a loop turning the VotingTime value on and off for testing the functionality of the game concept. Think of it as a cycle script.

See here:

local RS = game:GetService("ReplicatedStorage")
local VotingTime = RS:FindFirstChild("VotingTime")

while true do
    wait(3)
    VotingTime.Value = true
    wait(3)
    VotingTime.Value = false
end
  • There is then another separate script that controls the status of the UIs, which is what this post is about.

There’s not much functionality to the game. I’m just exploring how I can make the UI appear to all players when it comes to voting time. That way the suspicion meter can encourage them to vote or not on a specific person. (Though, I’m just worrying on the visibility aspect first.)

I was recommended to not do that as that is a security issue. Though, I am open to hear a second opinion.

1 Like

Well, you can try it. It’s a server script after all and there are no remote events. Here’s what I did and it worked!

local RS = game:GetService("ReplicatedStorage")
local UI_tag = RS:FindFirstChild("UI")
local VotingTime = RS:FindFirstChild("VotingTime")

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		UI_tag:Clone().Parent = character.Head
		player.PlayerGui.UI.Adornee = character.Head
		
		VotingTime.Changed:Connect(function()
			if VotingTime.Value == true then
				for _, v in ipairs(game.Players:GetChildren()) do
					if v:IsA("Player") and v ~= nil then
						local playerGui = v.PlayerGui
						playerGui.UI.Main.Visible = true -- Reference your UI.
					end
				end
			else
				for _, v in ipairs(game.Players:GetChildren()) do
					if v:IsA("Player") and v ~= nil then
						local playerGui = v.PlayerGui
						playerGui.UI.Main.Visible = false -- Reference your UI.
					end
				end
			end
		end)
	end)
end)

You can try to change your code to this:

local RS = game:GetService("ReplicatedStorage")
local UI = RS:FindFirstChild("UI")
local VotingTime = RS:FindFirstChild("VotingTime")


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		UI:Clone().Parent = player.PlayerGui
		player.PlayerGui.UI.Adornee = character.Head
		
		while wait() do
			if VotingTime.Value == true then
				for _, v in ipairs(game.Players:GetChildren()) do
					if v:IsA("Player") and v ~= nil then
						local playerGui = v.PlayerGui
						playerGui.UI.Main.Visible = true -- Reference your UI.
					end
				end
			else
				for _, v in ipairs(game.Players:GetChildren()) do
					if v:IsA("Player") and v ~= nil then
						local playerGui = v.PlayerGui
						playerGui.UI.Main.Visible = false -- Reference your UI.
					end
				end
			end
		end
	end)
end)

Sorry, I meant this was the code I used

local RS = game:GetService("ReplicatedStorage")
local UI_tag = RS:FindFirstChild("UI")
local VotingTime = RS:FindFirstChild("VotingTime")

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		UI_tag:Clone().Parent = character.Head
		character.Head.UI.Adornee = character.Head
		
		VotingTime.Changed:Connect(function()
			if VotingTime.Value == true then
				for _, v in ipairs(game.Players:GetChildren()) do
					if v:IsA("Player") and v ~= nil then
						local playerGui = v.Character.Head.UI
						playerGui.Main.Visible = true -- Reference your UI.
					end
				end
			else
				for _, v in ipairs(game.Players:GetChildren()) do
					if v:IsA("Player") and v ~= nil then
						local playerGui = v.Character.Head.UI
						playerGui.Main.Visible = false -- Reference your UI.
					end
				end
			end
		end)
	end)
end)

While this is the only solution so far, I’m still a bit hesitant to use this code due to an ongoing bug.

I’m trying to steer away from placing things inside the character (because I did it a lot).

EDIT: But if this is the only way to do what I’m trying to do, then so be it I guess :confused:

i mean what’re they gonna do? not see the voting script?

I don’t want exploiters being able to view anybody’s BillboardGui through the character because later on I’m going to be relying on them as a voting system with a little number off to the side.

Furthermore, if the bug stated above is true, I don’t want an exploiter deleting their BillboardGui, ultimately giving them the benefit of not allowing players to see their suspicion meter.

EDIT: Ultimately I’ve settled on putting the BillboardGui inside the Head of the player. I’ll just have to come up with ways on how I can counter this if the Client somehow deletes the UI.

1 Like