Why do you need to do this? Couldn’t you send a HTTP Request to a discord webhook and have all the details in there you could put ;
Mod needed reason
Time they where called
Username
And then the person could see the mod call / or report VIA webhook, and evidence can be provided there, then the player can be kicked/or banned. If you don’t like this method, let me know. I can try writing up a solution with your current method.
Couldn’t you send the JobId to the webhook, and then the mod who is going to accept it will join a server, they have a panel, and paste the job ID in there, and it does the same thing.
When the report is sent it would send game.JobId and the report reason + the player name and time created. After that everything would be separated in the webhook to keep clean organization, the mod who accepts it would then join the server, and paste the JobID.
But if the webhook system works, why use your current system? Nothing seems wrong currently with the system.
Also try this instead of what you currently have ;
function MakeModcall(plr, msg) --All you need is plr and msg, remove the rest. A player could fire the server with a different placeId and JobId and "troll" the mod
for _,v in pairs(game.Players:GetPlayers()) do
if moderators[v.UserId] ~= nil or moderators[v.Name] ~= nil then
local modcall = script.ModCall:Clone()
modcall.Parent = v.PlayerGui.ModcallHistory.Frame
modcall.PlaceId.Value = game.PlaceId
modcall.JobId.Value = game.JobId
modcall.Username.Text = plr.Name
modcall.Comments.TextLabel.Text = msg
break
end
end
end
Is the ModcallHistory ScreenGui located in StarterGui? If so, then the modcall.Parent = v.PlayerGui.ModcallHistory.Frame
part is wrong. The reason behind this is because the client loads the GUIs in PlayerGui, not the server, so the server can’t read any GUIs in the PlayerGui, causing it to error.
Nevermind, the reason above isn’t the reason.
If it’s not that, then moving modcall.Parent = v.PlayerGui.ModcallHistory.Frame to above break should do the trick. The reason why we should do this is because the LocalScript may just instantly check the values of PlaceId and JobId once, even if it changes.
local moderators = require(game:GetService(“ServerStorage”):WaitForChild(“Moderators”))
local tpservice = game:GetService("TeleportService")
local event = Instance.new("RemoteEvent", game:GetService("ReplicatedStorage").RemoteEvents:WaitForChild("Modcall"))
event.Name = "History"
function MakeModcall(plr, msg, placeId, jobId)
for _,v in pairs(game.Players:GetPlayers()) do
if moderators[v.UserId] or moderators[v.Name] then
local modcall = script.ModCall:Clone()
modcall.PlaceId.Value = placeId
modcall.JobId.Value = jobId
modcall.Username.Text = plr.Name
modcall.Comments.TextLabel.Text = msg
modcall.Parent = v.PlayerGui.ModcallHistory.Frame
end
end
end
function AcceptModcall(plr, placeId, jobId)
tpservice:TeleportToPlaceInstance(placeId, jobId, plr)
end
game.Players.PlayerAdded:Connect(function(plr)
if moderators[plr.UserId] or moderators[plr.Name] then
if not plr.PlayerGui:FindFirstChild("ModcallHistory") then
script.ModcallHistory:Clone().Parent = plr.PlayerGui
end
end
end)
event.OnServerEvent:Connect(function(plr, cmd, text, placeId, jobId, modcaller)
if cmd == "Make" then
MakeModcall(modcaller, text, placeId, jobId)
elseif cmd == "Accept" then
AcceptModcall(plr, placeId, jobId)
end
end)
Basically, if you spam Discord requests (for example, randomly your game gets super popular and you are rolling out a ton of bans since you found out a ton of people broke the rules) then it will spam the Discord webhooks. Discord doesn’t allow overuse of their system and you can risk your Discord account getting terminated.
function MakeModcall(player, message)
local t = {}
t.Creator = player.Name
t.CreatorId = player.UserId
t.Comment = game:GetService("Chat"):FilterStringForBroadcast(message, player)
t.PlaceId = game.PlaceId
t.JobId = game.JobId
for _,v in pairs(game.Players:GetPlayers()) do
if moderators[v.UserId] ~= nil or moderators[v.Name] ~= nil then
modcall_data:FireClient(v, t.Comment, t.PlaceId, t.JobId, player)
break
end
end
game:GetService("MessagingService"):PublishAsync("Modcall", httpService:JSONEncode(t))
end
That’s the reason why! It actually sends two modcalls instead of one by sending it from MessagingService, and sending from the server itself.
local tpservice = game:GetService("TeleportService")
local event = Instance.new("RemoteEvent", game:GetService("ReplicatedStorage").RemoteEvents:WaitForChild("Modcall"))
event.Name = "History"
function MakeModcall(data)
data = game:GetService("HttpService"):JSONDecode(data["Data"])
local plr = game.Players:GetPlayerByUserId(data.CreatorId)
local msg = data.Comment
local placeId = data.PlaceId
local jobId = data.JobId
for _,v in pairs(game.Players:GetPlayers()) do
if moderators[v.UserId] or moderators[v.Name] then
local modcall = script.ModCall:Clone()
modcall.PlaceId.Value = placeId
modcall.JobId.Value = jobId
modcall.Username.Text = data.Creator
modcall.Comments.TextLabel.Text = msg
modcall.Parent = v.PlayerGui.ModcallHistory.Frame
end
end
end
game:GetService("MessagingService"):SubscribeAsync("Modcall", MakeModcall)
function AcceptModcall(plr, placeId, jobId)
tpservice:TeleportToPlaceInstance(placeId, jobId, plr)
end
game.Players.PlayerAdded:Connect(function(plr)
if moderators[plr.UserId] or moderators[plr.Name] then
if not plr.PlayerGui:FindFirstChild("ModcallHistory") then
script.ModcallHistory:Clone().Parent = plr.PlayerGui
end
end
end)
event.OnServerEvent:Connect(function(plr, cmd, text, placeId, jobId, modcaller)
if cmd == "Make" then
local t = {}
t.Creator = plr.Name
t.CreatorId = plr.UserId
t.Comment = game:GetService("Chat"):FilterStringForBroadcast(text, plr)
t.PlaceId = game.PlaceId
t.JobId = game.JobId
game:GetService("MessagingService"):PublishAsync("Modcall",httpService:JSONEncode(t))
MakeModcall(plr, text, placeId, jobId)
elseif cmd == "Accept" then
AcceptModcall(plr, placeId, jobId)
end
end)