Hello, the script (below) is supposed to display the emergency messages that the players send, to the police players (so in the police team). Except that when a civilian sends a message, it is not displayed for the police players. However, if the player who sent the message becomes a policeman and sends a message back, it works. How to make the sent message appear for all the police team and not only for the player who sent the message?
script :
local players = game:GetService("Players")
local player = players.LocalPlayer
local Teams = game:GetService("Teams")
local PoliceTeam = Teams.Police
script.Parent.Parent.SendButton.MouseButton1Click:Connect(function()
if player.TeamColor == PoliceTeam.TeamColor then
player:WaitForChild("PlayerGui").EmergencyCalls.PoliceFrame.Visible = true
player:WaitForChild("PlayerGui").EmergencyCalls.PoliceFrame.CallText.Text = script.Parent.Parent.TextBox.Text
wait(10)
player:WaitForChild("PlayerGui").EmergencyCalls.PoliceFrame.Visible = false
end
end)
how I built this :
thanks in advance and sorry, I don’t know how to code so I’m having trouble
local players = game:GetService("Players")
local player = players.LocalPlayer
local Teams = game:GetService("Teams")
local PoliceTeam = Teams.Police
script.Parent.Parent.SendButton.MouseButton1Click:Connect(function()
if player.Team == PoliceTeam then
player:WaitForChild("PlayerGui").EmergencyCalls.PoliceFrame.Visible = true
player:WaitForChild("PlayerGui").EmergencyCalls.PoliceFrame.CallText.Text = script.Parent.Parent.TextBox.Text
wait(10)
player:WaitForChild("PlayerGui").EmergencyCalls.PoliceFrame.Visible = false
end
end)
If you think it’s the best solution I’ll go with that but I confess I personally don’t know how to do what you advise, could you show me? If not, don’t worry, I’ll wait for someone else to help me good evening or morning…
Hi! your script works but it’s not what I want to do. come here because I explained it better and I’ve made some progress on the code since please: How to display a UI for a Team only