Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Discord Chatlog script. Adding grouprank into message?

Asked by
s_21 74
5 years ago

As Discord now allow web requests from Roblox again, I started using a chatlog system. The game is very small and only sends around 50 messages a day, so I'm not overfilling the API, so please don't lecture me about that.

I have the basic script sorted out, But Im wondering how to make it so the players group rank also appears next to the name. Currently the discord message is as follows.

WEBHOOK USERNAME - Player name WEBHOOK CONTENT - Player message.

Id like it to be like this in the server

WEBHOOK USERNAME - Playername,playerrank WEBHOOK CONTENT - Player message,

All help is appreciated. My current script in located below.

``` local url = "REMOVED DUE TO SECURITY" local http = game:GetService('HttpService')

game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(msg) local data = { ['username'] = plr.Name, ['content'] = msg } local newdata = http:JSONEncode(data) http:PostAsync(url,newdata) end) end) ```

0
['username'] = ""..plr.Name.." "plr:GetRankInGroup(GroupId), SuperSamyGamer 316 — 5y

1 answer

Log in to vote
2
Answered by 5 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.
local url = "REMOVED DUE TO SECURITY" 
local http = game:GetService('HttpService')

game.Players.PlayerAdded:connect(function(plr)
    plr.Chatted:connect(function(msg)
        local data = {
            ['username'] = ""..plr.Name.." Rank:"..plr:GetRankInGroup(GroupId),
            ['content'] = msg
        }
        local newdata = http:JSONEncode(data)
        http:PostAsync(url,newdata)
    end)
end)
Ad

Answer this question