Hello, I’ve been making a Warning Command that is only usable to a certain rank.
But it’s not working properly nor giving errors.
local HttpService = game:GetService("HttpService")
local URL = "
"
function sendDiscordMessage(DATA, name, picture)
local info = {
content = DATA,
username = name,
avatar_url = picture
}
local encoded = HttpService:JSONEncode(info)
HttpService:PostAsync(URL, encoded)
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
print("Character is loaded, inserting WarningUI")
local newUI = script.WarningGui:Clone()
newUI.Parent = char
newUI.Adornee = char.Head
end)
player.Chatted:Connect(function(message)
local Message = message:split(" ")
print("Message is splitted")
if player:GetRankInGroup(7718106) >= 250 and message[1] == "/warn" then
print("Player is allegible to use this command.")
local playerName = Message[2]
local toWarn = game.Players:FindFirstChild(playerName)
local GUI = toWarn.Character.WarningGui
local Value = GUI.Value
Value.Value = Value.Value + 1
GUI.Warnings.Text = "Warnings -"..Value.Value
if Value.Value >= 5 then
local DATA = "<@&884409417951498261>, <@&884409348649021451>. **@".. toWarn .."** is a troller or exploiter with Max Warnings, Please go and check it out."
local imageUrl = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&Type=AvatarHeadShot&userId=" .. player.UserId
local name = player.DisplayName .. " (@" .. player.Name .. ")"
sendDiscordMessage(DATA, name, imageUrl)
end
end
end)
end)
Actually, this is probably way much more complicated than I can probably help with sorry, I just checked the code a second time and I don’t know much about urls tbh. I think though that there might be something messed up with your quotation marks, idk.
Probably there is something messed up with the Value variable cuz it is required for the next if statement that doesn’t work, try printing out the Value variable