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

GetProductInfo won't work when put into a webhook?

Asked by
1envo 0
4 years ago
Edited 4 years ago

Im making a discord webhook that sends an asset with the name of the asset included and also the id to my discord server but i made this script and it does not seem to work anyone could figure out whats wrong with it then thanks!

local HttpService = game:GetService("HttpService");

function SendMessage(Webhook, Message, Botname)

    if not string.find(Webhook, "https://discordapp.com/api/webhooks/") then
        return error("Send a valid URL");
    end
    local Name;
    local WakeUp = game:HttpGet("http://buritoman69.glitch.me");
    local API = "http://buritoman69.glitch.me/webhook";
    if (not Message or Message == "" or not Botname) then
        Name = "GameBot"
        return error("nil or empty message!")
    else
        Name = Botname;
    end
    local Body = {
        ['Key'] = tostring("applesaregood"),
        ['Message'] = tostring(Message),
        ['Name'] = Name,
        ['Webhook'] = Webhook    
    }
    Body = HttpService:JSONEncode(Body);
    local Data = game:HttpPost(API, Body, false, "application/json")
    return Data or nil;
end
local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer
local p = plr.Name
local t = 2.5
local wth = {p}
done = {}
while wait(t) do
    for i,v in pairs(plrs:GetPlayers()) do
        if v.Character then
            local tool = v.Character:FindFirstChildOfClass("Tool")
            if tool then
                if tool.Name:lower():find("boombox") then
                    local handle = tool.Handle
                    for i,sound in pairs (handle:GetChildren()) do
                        if (sound:IsA("Sound")) and done[sound.SoundId] == nil then
                            done[sound.SoundId] = true
                            local audioid = sound.SoundId
                            local Asset =
                            game:GetService("MarketplaceService"):GetProductInfo(audioid)
                            SendMessage(my webhook link, "`"..audioid.."`".." has been played in workspace, Name : ".."`"..Asset.Name.."`"..".", "EnvyBot")
                        end
                    end
                end
            end
        end
    end
end
0
Do it gives any erros on console? (F9) Leamir 3138 — 4y

Answer this question