Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Expected '}' (to close '{' at line 9), got '[' ?

So i am trying to make a discord webhook thingy and the local script freaks out and says: Expected '}' (to close '{' at line 9), got '[' Can some of you fix this?

Localscript:

local WHU = "I will not allow you to make my bot text on my discord server, Also im not that dumb :|"
local httpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local Plr = Players.LocalPlayer
local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = replicatedStorage:WaitForChild("Send")

function Click()
	local data = {
		['content'] = "Player "..Plr.Name.." has sended something!"
		['embeds'] = [
		]
		}
	local finalData = httpService:JSONEncode(data)
	remoteEvent:FireServer(WHU, finalData)
end
 
script.Parent.MouseButton1Click:Connect(Click)

--[[
{
  "content": "Player hasanchik sended something!",
  "embeds": [
    {
      "description": "Hello. This is my final message.",
      "color": 16711680,
      "author": {
        "name": "hasanchik",
        "url": "https://web.roblox.com/users/388243015/profile",
        "icon_url": "https://tr.rbxcdn.com/5dccb86ea2be3852007a91c56f5dc00b/100/100/Avatar/Png"
      },
      "footer": {
        "text": "PlayerId"
      }
    }
  ]
}
--]]

2 comments

0

Delete the enter at line 11-12, I think the script is thinking You are closing the table with ] ?

0

I do not understand what you just said.

3 answers

try

local WHU = "I will not allow you to make my bot text on my discord server, Also im not that dumb :|"
local httpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local Plr = Players.LocalPlayer
local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = replicatedStorage:WaitForChild("Send")

function Click()
    local data = {
        ['content'] = "Player "..Plr.Name.." has sended something!"
        ['embeds'] = {}
        }
    local finalData = httpService:JSONEncode(data)
    remoteEvent:FireServer(WHU, finalData)
end

script.Parent.MouseButton1Click:Connect(Click)

honestly i have no clue what this does but you ended the table wrong, this fixes the table part, so it might work

Method 1) On lines 11 and 12, you are making a table with [] instead of {}

Method 2) I am pretty sure another method would be to change lines 11 and 12 from this:

['embeds'] = [
]

to this:

['embeds'] = []

You might also need replace [] to {} in method 2.

2 comments

0

I will try it.

0

It sitll does not work

Oof, I forgot to use , .

local WHU = "I will not allow you to make my bot text on my discord server, Also im not that dumb :|"
local httpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local Plr = Players.LocalPlayer
local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = replicatedStorage:WaitForChild("Send")

function Click()
    local data = {
        ['content'] = "Player "..Plr.Name.." has sended something!",
        ['embeds'] = [
        ],
        }
    local finalData = httpService:JSONEncode(data)
    remoteEvent:FireServer(WHU, finalData)
end

script.Parent.MouseButton1Click:Connect(Click)

This discussion is preserved as it was. New answers, comments, and votes are closed.