Server Message Issue

Hey, I have a problem where I’m trying to make a message appear whenever somebody gets banned, but the message just doesn’t fire.

Local Script inside Starter Gui

local function serverMessage(content)
	game.StarterGui:SetCore("ChatMakeSystemMessage", {Text = "[AAC] "..content,Color3.fromHSV(0.992, 0.815686, 1),Font = Enum.Font.SourceSansLight})
end

game:GetService("ReplicatedStorage").AACEVENTS.servermsg.OnClientEvent:Connect(function(msg)
	serverMessage(msg)
end)

Server Script

local dds = game:GetService("DataStoreService")
local banData = dds:GetDataStore(game.CreatorId.."dqhdaiaqSkdsqjqn".."_aac")

game.Players.PlayerAdded:Connect(function(plr)
   wait(plr:WaitForChild("AAC"):WaitForChild("Warnings").Value)
	if banData:GetAsync(plr.UserId,true) then
		plr:Kick("Server Connection Failed - Error Msg: The user ID "..plr.UserId.." is banned from connecting to the server")
	else
		plr.Chatted:Connect(function(msg)
			if msg == ";" then
				if plr.AAC.Warnings.Value == 3 then
					banData:SetAsync(plr.UserId,true)
					plr:Kick("Session forcefully ended")
					game:GetService("ReplicatedStorage").AACEVENTS.servermsg:FireAllClients(plr.Name.." has been permanently banned for exploiting.")
				else
					plr.AAC.Warnings.Value = plr.AAC.Warnings.Value + 1
					plr:Kick("Disconnected from server: the usage of ';' is banned")
				end
			end
		end)		
	end
end)
1 Like

does the event print out? that way you can check if it is being fired

1 Like

It’s doesn’t print. That’s actually a good point.

1 Like

Are you here? I still need help

1 Like

Are you sure the person is getting banned?

1 Like

Does it have any errors showing up?

100%. I tested it on my alt, they are indeed banned and I rejoined like 5 times.

1 Like

Let me see the console in game…

1 Like

I think swapping the kick function and the remote event being called could do it because the Kick returns it I think

Both server & client errors:


1 Like

ohhh your missing 1 bracket on client side

Let’s test that then, I’ll fire the remote event rq

it should be

:Connect(function(msg))

No, it is correct. The msg is print fine. The problem is the serverMessage function

image

That makes no sense. The second bracket is supposely the “end”'s bracket if you are experienced with roblox studio. Your basically adding a extra bracket to a end function.

Probably a formatting mistake then.

You forgot “Color”. You instead just use Color3.fromHSV
image

Fix :

local function serverMessage(content)
	game.StarterGui:SetCore("ChatMakeSystemMessage", {Text = "[AAC] "..content,Color = Color3.fromHSV(0.992, 0.815686, 1),Font = Enum.Font.SourceSansLight})
end
1 Like

And that’s what happens when you don’t check your code afterwards. Alright thanks though lol

Next time try to move it down like this. So you won’t get confused.

image