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

How to add blank line to webhook?

Asked by
Ifigil 4
4 years ago
                local data = {
                    ['username'] = "SpeedCam",
                    ['content'] = Player.Name.." ".. " has been caught speeding!"..

                    "Username: "..Player.Name..

                    "Speed: "..tostring(math.floor(Touch.Velocity.Magnitude/2)) .. " sps in a " .. tostring(math.floor(Detector.Parent.SpeedLimit.Value)) .. " sps zone."}

                    local newdata = HTTP:JSONEncode(data)
                    HTTP:PostAsync(webhook, newdata)

I cant seem to figure out how to make this script leave a blank line in between of the contents. When i run it it gives me all the info in one line like this: "ifigil has been caught speeding!Username: ifigilSpeed: 43 sps in a 10 sps zone."

1 answer

Log in to vote
1
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

You can use the newline control character if you want to be technical. This is a special character that instructs the following string to drop a line.

local HttpService = game:GetService("HttpService")

local SpeedLimit = Detector.Parent.SpeedLimit
local SPS = (Touch.Velocity.Magnitude / 2)

local Data = {
    ["username"] = "SpeedCam",
    ["content"] = Player.Name.." has been caught speeding!\n".. "\nSpeed: "..SPS.. " SPS in a "..math.floor(SpeedLimit.Value).. " SPS zone."
}

local DataPacket = HttpService:JSONEncode(Data)
HttpServicePostAsync(Webhook, DataPacket)
0
Thanks this worked like supposed to Ifigil 4 — 4y
Ad

Answer this question