Expected <eof>, got 'end'

Hello! I’m creating a military training zone, made for a group. I’m still creating it, including some scripts in it. Most of them work but one of them I’m gonna talk about here doesn’t.

  1. What do you want to achieve?
    I saw a tutorial on YouTube, with a guy showing his script. I used the tutorial and edited the script, everything looks great. The script is used to give specific items automatically to player depending on his rank in group.

  2. What is the issue?
    bruh - YouTube
    i guess people didnt see whats the error, the error is Expected <eof>, got 'end'
    on the last end)

  3. What solutions have you tried so far?
    No. I don’t know what type of error is this and how it can be fixed.

The script:

local Folder = game.ServerStorage.CardStorage
local Storage = game.ServerStorage
local AP = Folder["AP ID Card"]
local Trainee = Folder["Trainee ID Card"]
local Corporal = Folder["Corporal ID Card"]
local Sergeant = Folder["Sergeant ID Card"]
local Lieutenant = Folder["Lieutenant ID Card"]
local TL = Folder["Team Leader ID Card"]
local CO = Folder["CO ID Card"]
local Commander = Folder["Commander ID Card"]
local HC = Folder["HC ID Card"]
local OWNER = Folder["OWNER ID Card"]
local EHU = Storage["EHU ID Card"]
local Armoury = Storage["Armoury Keycard"]
local HR = Folder["HR ID Card"]
local Detain = Storage.Detain
local Remote = Storage.Remote
local M4A1 = Storage.M4A1
local Deagle = Storage["Desert Eagle"]


game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		--if player.TeamColor == BrickColor.new("Bronze") then
			--print("Onteam")
		if player:GetRankInGroup(10870927) == 100 then --Awaiting Placement
				local a = AP:Clone()
				a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 150 then --Trainee Operative
				local a = Trainee:Clone()
				a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 180 then --Corporal Operative
				local a = Corporal:Clone()
				a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 200 then --Sergeant Operative
				local a = Sergeant:Clone()
				a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 205 then --Lieutenant Operative
				local a = Lieutenant:Clone()
			    a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 251 then --Team Leader
			    local a = TL:Clone()
			a.Parent = player.Backpack
			local b = Armoury:Clone()
			a.Parent = player.Backpack
			local c = M4A1:Clone()
			a.Parent = player.Backpack
			local d = Deagle:Clone()
			a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 252 then --Commanding Officer
			local a = CO:Clone()
			a.Parent = player.Backpack
			local b = Armoury:Clone()
			a.Parent = player.Backpack
			local c = M4A1:Clone()
			a.Parent = player.Backpack
			local d = Deagle:Clone()
			a.Parent = player.Backpack
			local f = Remote:Clone()
			a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 253 then --Commander
			local a = Commander:Clone()
			a.Parent = player.Backpack
			local b = Armoury:Clone()
			a.Parent = player.Backpack
			local c = M4A1:Clone()
			a.Parent = player.Backpack
			local d = Deagle:Clone()
			a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 254 then --Head Commander
			local a = HC:Clone()
			a.Parent = player.Backpack
			local b = Armoury:Clone()
			a.Parent = player.Backpack
			local c = M4A1:Clone()
			a.Parent = player.Backpack
			local d = Deagle:Clone()
			a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 255 then --Owner
			local a = OWNER:Clone()
			a.Parent = player.Backpack
			local b = Armoury:Clone()
			a.Parent = player.Backpack
			local c = M4A1:Clone()
			a.Parent = player.Backpack
			local d = Deagle:Clone()
			a.Parent = player.Backpack
			end
		end)
	end)
end)

Please help!
(i’m sorry if there was a topic that was answered, based on the same problem as mine’s, i dont know what to search about it)

1 Like

Thsi means you have to remove the end
You are calling only 3 functions , but you have 4 ends this means there’s one that isn’t needed


local Folder = game.ServerStorage.CardStorage
local Storage = game.ServerStorage
local AP = Folder["AP ID Card"]
local Trainee = Folder["Trainee ID Card"]
local Corporal = Folder["Corporal ID Card"]
local Sergeant = Folder["Sergeant ID Card"]
local Lieutenant = Folder["Lieutenant ID Card"]
local TL = Folder["Team Leader ID Card"]
local CO = Folder["CO ID Card"]
local Commander = Folder["Commander ID Card"]
local HC = Folder["HC ID Card"]
local OWNER = Folder["OWNER ID Card"]
local EHU = Storage["EHU ID Card"]
local Armoury = Storage["Armoury Keycard"]
local HR = Folder["HR ID Card"]
local Detain = Storage.Detain
local Remote = Storage.Remote
local M4A1 = Storage.M4A1
local Deagle = Storage["Desert Eagle"]


game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		--if player.TeamColor == BrickColor.new("Bronze") then
			--print("Onteam")
		if player:GetRankInGroup(10870927) == 100 then --Awaiting Placement
				local a = AP:Clone()
				a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 150 then --Trainee Operative
				local a = Trainee:Clone()
				a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 180 then --Corporal Operative
				local a = Corporal:Clone()
				a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 200 then --Sergeant Operative
				local a = Sergeant:Clone()
				a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 205 then --Lieutenant Operative
				local a = Lieutenant:Clone()
			    a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 251 then --Team Leader
			    local a = TL:Clone()
			a.Parent = player.Backpack
			local b = Armoury:Clone()
			a.Parent = player.Backpack
			local c = M4A1:Clone()
			a.Parent = player.Backpack
			local d = Deagle:Clone()
			a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 252 then --Commanding Officer
			local a = CO:Clone()
			a.Parent = player.Backpack
			local b = Armoury:Clone()
			a.Parent = player.Backpack
			local c = M4A1:Clone()
			a.Parent = player.Backpack
			local d = Deagle:Clone()
			a.Parent = player.Backpack
			local f = Remote:Clone()
			a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 253 then --Commander
			local a = Commander:Clone()
			a.Parent = player.Backpack
			local b = Armoury:Clone()
			a.Parent = player.Backpack
			local c = M4A1:Clone()
			a.Parent = player.Backpack
			local d = Deagle:Clone()
			a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 254 then --Head Commander
			local a = HC:Clone()
			a.Parent = player.Backpack
			local b = Armoury:Clone()
			a.Parent = player.Backpack
			local c = M4A1:Clone()
			a.Parent = player.Backpack
			local d = Deagle:Clone()
			a.Parent = player.Backpack
		elseif player:GetRankInGroup(10870927) == 255 then --Owner
			local a = OWNER:Clone()
			a.Parent = player.Backpack
			local b = Armoury:Clone()
			a.Parent = player.Backpack
			local c = M4A1:Clone()
			a.Parent = player.Backpack
			local d = Deagle:Clone()
			a.Parent = player.Backpack
			end)
		end)
	end)

If I’m not wrong

2 Likes

Actually, the last end) should be removed, not the end that closes the if and elseif statements… i think…since he only calls 2 functions (PlayerAdded, CharacterAdded)

It worked, but when I joined, it gave me only CO ID card and it didn’t give anything else. What do I do?

I don’t knwo that’s probably a problem with your script

check your a, b, c and d’s again, you forgot to change something
edit: i wouldn’t recommend using too much else ifs, use tables instead

ok guys i figured out how to fix it

the problem was; i had in a,b,c and d’s only a.Parent = player.Backpack so it just configures only a

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.