local Rest
for i ,v in ipairs(Answer) do
if Rest == "" then
Rest = ('{ ["name"] = "'..v..'", ["value"] = "["..player.Name.."](https://roblox.com/users/"..player.UserId.."/profile)", ["inline"] = true },')
else
Rest= Rest..("")
end
end
The thing is that the loop is not running but the rest of the code in the script does, which means it send to the discord webhook but simply does not adds the values. I tried printing i,v apart to see what happens but simply bypass it. Anyone can help me making the loop work?
The “Answers” table is being passed by a remote event. The table gets filled with information from the client. As shown below:
for i, Element in ipairs(Children) do
if Element:IsA("ImageLabel") then
if Element.Answer.Text ~= "" then
print("txt"..Element.Name)
AnswerQuery[string.sub(Element.Name, 9)] = Element.Answer.Text
else
warn(Element.Name)
Submit.Text = "MISSING ANSWER(S)"
wait(5)
Submit.Text ="APPLY"
return
end
end
end
--//Credits to iSt_xrm\\--
script.Parent.Submit.Activated:Connect(function()
--//Varibales\\--
local Event = game.ReplicatedStorage.Webhook
local Submit = script.Parent.Submit
local Children = script.Parent.Frame:GetChildren()
local plr = game.Players.LocalPlayer
local AnswerQuery = {}
table.sort(Children, function(a, b)
return string.lower(a.Name) < string.lower(b.Name)
end)
for i, Element in ipairs(Children) do
if Element:IsA("ImageLabel") then
if Element.Answer.Text ~= "" then
print("txt"..Element.Name)
AnswerQuery[string.sub(Element.Name, 9)] = Element.Answer.Text
else
warn(Element.Name)
Submit.Text = "MISSING ANSWER(S)"
wait(5)
Submit.Text ="APPLY"
return
end
end
end
Event:FireServer(AnswerQuery)
script.Parent.Parent.Questions.Visible = false
script.Parent.Parent.Sending.Visible = true
----
end)
Server:
--//Creidts to iSt_xrm\\--
--//Do not delete credits please. If you require further assistance make sure to contant ME only me through Discord. iSt_xrm#7250\\--
--//Varibales\\--
local EVENT = game.ReplicatedStorage.Webhook
EVENT.OnServerEvent:Connect(function(player, Answer)
--//Varibales\\--
local Http = game:GetService("HttpService")
local webHook = require(script.WebhookAPI)
local PlaceName = game:GetService('MarketplaceService'):GetProductInfo(game.PlaceId).Name
local IMG = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=200&Format=Png&username="..player.Name
local Title
local WebhookId
local WebhookToken
local Rest
for i ,v in ipairs(Answer) do
if Rest == "" then
Rest = ('{ ["name"] = "'..v..'", ["value"] = "["..player.Name.."](https://roblox.com/users/"..player.UserId.."/profile)", ["inline"] = true },')
else
Rest= Rest..("")
end
end
local Discord_Webhook = webHook.new(WebhookId,WebhookToken)
Discord_Webhook:post{
username = Title,
["embeds"] = {{
["title"] = "**Applications | By iSt_xrm**",
["type"] = "rich",
["color"] = tonumber(0xb51b20),
["thumbnail"] = {["url"] = IMG},
["footer"] = {
["text"] = "System by iSt_xrm",
["icon_url"] = "https://cdn.discordapp.com/attachments/636740004890017792/636748580639735828/256-256-5fbc60a4335d01cd9c35dcf8fae02410.png"},
["fields"] = {
{
["name"] = "Applicant :person_with_blond_hair:",
["value"] = "["..player.Name.."](https://roblox.com/users/"..player.UserId.."/profile)",
["inline"] = true
},
{
["name"] = "Applicant Rank :medal:",
["value"] = player:GetRoleInGroup(5121069),
["inline"] = true
},
Rest
}
}}
}
end)
did a quick read and this looks fine, the “error” must be coming from the client where the “AnswerQuery” must have no values in it. Before this line: