Im trying to make a message appear to everyone in the server, but it doesn’t quite appear to everyone, only to the client. And im unsure because “StarterGui:SetCore()” only works on a localscript which is where the message would be displayed. The script works fine, but just doesn’t appear globally…
Client script:
local players = game:GetService("Players")
local localplayerName = game.Players.LocalPlayer.Name
local leaderstats = players.LocalPlayer:WaitForChild("leaderstats")
local value = leaderstats:WaitForChild("Stage")
local StarterGui = game.StarterGui
local remote = game:GetService("ReplicatedStorage"):WaitForChild("Difficulty")
local messages = {
[3] = "[Server] "..localplayerName.." has reached Beginner Difficulty!",
[8] = "[Server] "..localplayerName.." has reached Effortless Difficulty!",
[14] = "[Server] "..localplayerName.." has reached Easy Difficulty!",
[20] = "[Server] "..localplayerName.." has reached Medium Difficulty!",
[25] = "[Server] "..localplayerName.." has reached Hard Difficulty!",
[33] = "[Server] "..localplayerName.." has reached Difficult Difficulty!",
[45] = "[Server] "..localplayerName.." has reached Extreme Difficulty!",
[58] = "[Server] "..localplayerName.." has reached Supreme Difficulty!",
[70] = "[Server] "..localplayerName.." has reached Absurd Difficulty!"
}
local colors = {
[3] = Color3.fromRGB(158, 158, 158),
[8] = Color3.fromRGB(132, 160, 114),
[14] = Color3.fromRGB(0, 189, 0),
[20] = Color3.fromRGB(52, 142, 64),
[25] = Color3.fromRGB(255, 255, 0),
[33] = Color3.fromRGB(255, 133, 26),
[45] = Color3.fromRGB(213, 115, 61),
[58] = Color3.fromRGB(255, 0, 0),
[70] = Color3.fromRGB(4, 175, 236),
}
local function chat1(message, color)
StarterGui:SetCore("ChatMakeSystemMessage", {Text = message, Color = color, Font = Enum.Font.DenkOne})
end
value.Changed:Connect(function()
remote:FireServer()
end)
remote.OnClientEvent:Connect(function(plr)
print("1")
local numberValue = tonumber(value.Value)
if numberValue then
print("2")
local message = messages[numberValue]
local color = colors[numberValue]
if message and color then
print("3")
chat1(message, color)
print("4")
end
end
end)
Serverscript:
local remote = game:GetService("ReplicatedStorage"):WaitForChild("Difficulty")
remote.OnServerEvent:Connect(function(plr)
remote:FireAllClients(plr)
end)
If anyone knows the solution please reply!