Why this message working for only 1 person

I’am using the RemoteEvent who open the text with value in team Police from other person, but this is working for only 1 person in team Police i wanna open this text for all in team Police i don’t why this is not working.
How can i open this text for all people in team Police?

LocalScript

local tool = script.Parent
local player = script.Parent.Parent.Parent.Name
local players = game:GetService('Players')
local ppl = players.LocalPlayer
local Character = ppl.Character or ppl.CharacterAdded:Wait()
tool.CanBeDropped = true
tool.ManualActivationOnly = false
tool.RequiresHandle = false
local gui = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui')
local button =  game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui'):WaitForChild('Phone')
local remote = game.ReplicatedStorage.RemoteEvent

button.Frame.Send.MouseButton1Click:Connect(function()
	local value = gui.Phone.Frame.Content.ContentText
	remote:FireServer(value)
	game.Workspace[player].Humanoid:UnequipTools()
	gui.Phone.Enabled = false
end)

Script

local remote = game.ReplicatedStorage.RemoteEvent
local players = game:GetService("Players")
local Teams = game:GetService("Teams")

remote.OnServerEvent:Connect(function(player,value)
	for _, player in pairs(players:GetPlayers()) do
		local gui = player:WaitForChild('PlayerGui')
		local button1 =  player:WaitForChild('PlayerGui'):WaitForChild('Message')
		if player.Team == Teams["Policja"] then
			gui.Message.Enabled = true
				gui.Message.TextBox.Text = value
			button1.Close.MouseButton1Click:Connect(function()
				gui.Message.Enabled = false
			end)

Its because the remote event seems to be firing 1 player. you need the local script to be doing FireAllServer is your mistake. Change fireserver to firallserver

So how can i send the message for team police?

You would need to change FireServer() to FireAllServer() if it doesn’t work let me know

Replace server script with this:

local remote = game.ReplicatedStorage.RemoteEvent
local players = game:GetService("Players")
local Teams = game:GetService("Teams")

remote.OnServerEvent:Connect(function(player,value)
   for _, plr in pairs(Teams.Policja:GetPlayers()) do
      local gui = plr:WaitForChild('PlayerGui')
      local button1 =  gui:WaitForChild('Message')
      button1.Enabled = true
      button1.TextBox.Text = value
			 
  button1.Close.MouseButton1Click:Connect(function()
      button1.Enabled = false
   end)

Tell me if you have any problems.

1 Like

There’s no function named FireAllServer. Please don’t reply if you don’t know how to do this…:pleading_face:

change this to the “plr” variable from the for loop, not the player variable received from the event.

1 Like

Sorry I was thinking of FireAllClient, sorry for the misconception.

Its not needed anyway, because it can only be called from server.

1 Like

Yea its working!, but other player in police get this information with a slight delay, but it’s not a problem!
Thank you so much :hearts:

1 Like

Can you mark my post as a solution please🙃