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

A Server Script isn't working in a gui, can I not use player in a remote event? (Answered)

Not sure why this script isn't working. Can I not use player in a remote event? I would also like to ask how would I make this show on everybody's gui?

local remote = game.ReplicatedStorage.JoinEvent
remote.OnServerEvent:Connect(function(player)
	local frame = player.PlayerGui.LobbyGui.Frame
	
	if frame.Players.Script.Players.Value < frame.Players.Script.MaxPlayers.Value then
		if frame.Player2.Text == "" then
			frame.Player2.Text = player.Name
			frame.Player2.Player2.Value = player.Name
			
			elseif frame.Player3.Text == "" then
				frame.Player3.Text = player.Name
				frame.Player3.Player3.Value = player.Name
		else
			frame.Player4.Text = player.Name
			frame.Player4.Player4.Value = player.Name
		end
		end
end)

1 answer

So, there was no issue, I just couldn't see the player joining on the screen that I wanted it to show. Which was all the players guis. Earlier I found some code, still not exactly sure how it works, but its this for i, v in pairs(game.Players:GetPlayers()) do. I use the v in it, and I think it repeats changing the stuff in all the players guis, when I use v.PlayerGui.GuiName. Im also still using a server script! If I use a local one, it will still just show it on the client side and not to all the players. So I made a variable for my frame I would just do v.PlayerGui.LobbyGui.Frame, and that works for it.

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