local GroupId = 5774015
local httpService = game:GetService("HttpService")
local webhookURL = "the discord webhook url"
local minimumRankToUseCommmand = 3
local function ContactER(DiscordMessage)
local Data = {
["content"] = DiscordMessage
}
Data = httpService:JSONEncode(Data)
httpService:PostAsync(webhookURL,Data)
end
game.Players.PlayerAdded:Connect(function(player)
if player:GetRankInGroup(GroupId) < minimumRankToUseCommmand then
script:Destroy()
end
player.Chatted:Connect(function(Message)
local SplitMessage = Message:Split(" ")
if SplitMessage[1] == ":exploiter" then
local NameOfPotentialExploiter = SplitMessage[2]
local PotentialExploiter = game.Players:FindFirstChild(NameOfPotentialExploiter)
ContactER("@765289353215606834, "..NameOfPotentialExploiter.." has been reported for exploiting.")
end
end)
end)
Anyways, the issue appears to be that you’re using :Split() wrong. It should be :split().
As a side note, you shouldn’t be destroying the script if a player joins and they aren’t the correct rank. I fixed up the code for you. Instead, just don’t hook the Chatted event.
local GroupId = 5774015
local httpService = game:GetService("HttpService")
local webhookURL = ""
local minimumRankToUseCommmand = 3
local function ContactER(DiscordMessage)
local Data = {
["content"] = DiscordMessage
}
Data = httpService:JSONEncode(Data)
httpService:PostAsync(webhookURL,Data)
end
game.Players.PlayerAdded:Connect(function(player)
if player:GetRankInGroup(GroupId) >= minimumRankToUseCommmand then
player.Chatted:Connect(function(Message)
local SplitMessage = Message:split(" ")
if SplitMessage[1] == ":exploiter" then
local NameOfPotentialExploiter = SplitMessage[2]
local PotentialExploiter = game.Players:FindFirstChild(NameOfPotentialExploiter)
ContactER("@765289353215606834, "..NameOfPotentialExploiter.." has been reported for exploiting.")
end
end)
end
end)
Sorry for late response, I was at my golf practice. Thank you! This works, but one problem, it doesnt ping the role, it just says @the numbers. Is there a way to get it to ping the role?