Expected 'end' to close to function at line 12, got <eof>

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Fix the End error
  2. What is the issue? Include screenshots / videos if possible!
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Tried retyping the whole script, but doesn’t work.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Script:

local Http = game:GetService("HttpService")

local BASE_URL = ""
local TextService = game:GetService("TextService")
local Events = game.ReplicatedStorage.StaffReport

local Blacklist = {}
local LastSent = {}
local BanData = game:GetService("DataStoreService"):GetDataStore("ASDAIDSHDUH")
game.Players.PlayerAdded:Connect(function(player)
	
	Events.Blacklisted.OnServerInvoke = function(Plr)
		--return nil
		
		local success, blacklisted = pcall(function()
			if success then
				if Plr.ReportBanned.Value == true then
					return Blacklist[Plr]
				end
				else
					return nil
	end
end)
	
	Events.Report.OnServerEvent:Connect(function(Plr, report)
		local Filtered = TextService:FilterStringAsync(report, Plr.UserId)
		local FilterResult = Filtered:GetNonChatStringForBroadcastAsync()
		if Blacklist[Plr] then
			game.ReplicatedStorage.AdminFolder.ServerReportExploit:Fire(Plr, "Attempt to report user while blacklisted")
			elseif LastSent[Plr] and tick() - LastSent[Plr] < 30 then
				game.ReplicatedStorage.AdminFolder.ServerReportExploit:Fire(Plr, "Attempt to spam report user")
				else
					LastSent[Plr] = tick()
					local data =
					{	["username"] = "Dixie Creamery Cafe Report from"..Plr.UserId.." aka "..Plr.Name..".",
						["content"] = FilterResult,
					}
					Http:PostAsync(BASE_URL, Http:JSONEncode(data))
		end
end)
2 Likes
local Http = game:GetService("HttpService")

local BASE_URL = ""
local TextService = game:GetService("TextService")
local Events = game.ReplicatedStorage.StaffReport

local Blacklist = {}
local LastSent = {}
local BanData = game:GetService("DataStoreService"):GetDataStore("ASDAIDSHDUH")
game.Players.PlayerAdded:Connect(function(player)
	
	Events.Blacklisted.OnServerInvoke = function(Plr)
		--return nil
		
		local success, blacklisted = pcall(function()
			if success then
				if Plr.ReportBanned.Value == true then
					return Blacklist[Plr]
				end
				else
					return nil
			end
		end)
	end
end)
	
	Events.Report.OnServerEvent:Connect(function(Plr, report)
		local Filtered = TextService:FilterStringAsync(report, Plr.UserId)
		local FilterResult = Filtered:GetNonChatStringForBroadcastAsync()
		if Blacklist[Plr] then
			game.ReplicatedStorage.AdminFolder.ServerReportExploit:Fire(Plr, "Attempt to report user while blacklisted")
			elseif LastSent[Plr] and tick() - LastSent[Plr] < 30 then
				game.ReplicatedStorage.AdminFolder.ServerReportExploit:Fire(Plr, "Attempt to spam report user")
				else
					LastSent[Plr] = tick()
					local data =
					{	["username"] = "Dixie Creamery Cafe Report from"..Plr.UserId.." aka "..Plr.Name..".",
						["content"] = FilterResult,
					}
					Http:PostAsync(BASE_URL, Http:JSONEncode(data))
		end
end)```

oof now it says success isnt a globallllll

Why are you putting a pcall where you could just be adding checks to make sure that the data you are looking for is there? When you say return inside of the pcall, it returns the pcalled function instead of the main function that you are trying to return. I’ve removed the pcall and added a check, this should likely solve your problem unless there’s an error somewhere else in your code.

Also, it doesn’t make sense why you are connecting the OnServerInvoke function inside of the PlayerAdded event. The remote only needs to be connected once, and the Plr argument will automatically be passed to the function whether you place it inside of the PlayerAdded event or not. I’ve removed the redundant code with linking an event to PlayerAdded.

local Http = game:GetService("HttpService")

local BASE_URL = ""
local TextService = game:GetService("TextService")
local Events = game.ReplicatedStorage.StaffReport

local Blacklist = {}
local LastSent = {}
local BanData = game:GetService("DataStoreService"):GetDataStore("ASDAIDSHDUH")

	
	Events.Blacklisted.OnServerInvoke = function(Plr)
		if not (Plr and Plr:FindFirstChild("ReportBanned") and Blacklist) then return end
		if Plr.ReportBanned.Value == true then
			return Blacklist[Plr]
		else
			return
		end
	end
	
	Events.Report.OnServerEvent:Connect(function(Plr, report)
		local Filtered = TextService:FilterStringAsync(report, Plr.UserId)
		local FilterResult = Filtered:GetNonChatStringForBroadcastAsync()
		if Blacklist[Plr] then
			game.ReplicatedStorage.AdminFolder.ServerReportExploit:Fire(Plr, "Attempt to report user while blacklisted")
			elseif LastSent[Plr] and tick() - LastSent[Plr] < 30 then
				game.ReplicatedStorage.AdminFolder.ServerReportExploit:Fire(Plr, "Attempt to spam report user")
				else
					LastSent[Plr] = tick()
					local data =
					{	["username"] = "Dixie Creamery Cafe Report from"..Plr.UserId.." aka "..Plr.Name..".",
						["content"] = FilterResult,
					}
					Http:PostAsync(BASE_URL, Http:JSONEncode(data))
		end
end)
1 Like

It fixed my error and warning, thank you, sir. Appreciate your help.