Error <eof> but I used my ends correctly?

I think I used my ends correctly but it still says eof error?

local kb = game.ReplicatedStorage.KillBrick:Clone()
local killerteam = game:GetService("Teams")["Killer"]

wait(3)
game.Players.PlayerAdded:Connect(play)
  play.CharacterAdded:Connect(function(player)
    if (play.TeamColor == killerteam.TeamColor) then
        local character = play.Character or play.CharacterAdded:Wait()
        kb.Parent = character
        local weld = Instance.new("WeldConstraint")
        weld.Parent = character
        weld.Part0 = kb
        weld.Part1 = character.HumanoidRootPart
        kb.Position = character.HumanoidRootPart.Position
        kb.IsInUse.Value = true
    elseif player.TeamColor ~= killerteam.TeamColor then print("Not in Killer Team")
    end
end)
end)

I just go hitting enter on any function line and see which one adds an eof then cut and paste everything inside it

1 Like

Can you do it for me? I cant find it for some reason

In the code, there was a missing function in line 6.

local kb = game.ReplicatedStorage.KillBrick:Clone()
local killerteam = game:GetService("Teams")["Killer"]

wait(3)

game.Players.PlayerAdded:Connect(play) -- function is missing here
	play.CharacterAdded:Connect(function(player)
		if (play.TeamColor == killerteam.TeamColor) then
			local character = play.Character or play.CharacterAdded:Wait()
			kb.Parent = character
			local weld = Instance.new("WeldConstraint")
			weld.Parent = character
			weld.Part0 = kb
			weld.Part1 = character.HumanoidRootPart
			kb.Position = character.HumanoidRootPart.Position
			kb.IsInUse.Value = true
		elseif player.TeamColor ~= killerteam.TeamColor then
			print("Not in Killer Team")

		end
	end)
end)

In the studio code editor, hit Ctrl+A, then Alt+Shift+F. If you see any double ends exactly like so:

end
end

or anything that looks out of place, then remove one end statement or see what you can do to fix it.

edit: nevermind this is the answer