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

Weird error says " ServerScriptService.Main:7: Expected <eof>, got 'end'". How do I fix this?

I am making a tower defense game. There's this weird error that pops up when I try to run my game and prevents zombies from spawning on the map. This error is so bafflingly odd that I don't even know where to start.

Is there something I'm missing here? Wrongfully typed code? Missing semicolon? Can someone tell me what's wrong?

The code:

local mob = require(script.mob)

local map = workspace.Thickboard

mob.Spawn("Zombie",map, 4 )

end

Maybe it's something in the other script?

local ServerStorage = game:GetService("ServerStorage")
	local mob = {}
	 
	function mob.Spawn(name, map)
		    local mobExists = ServerStorage.Mobs:FindFirstChild(name)
		    if mobExists then
			        local newMob = mobExists:Clone()
			        newMob.HumanoidRootPart.CFrame = map.Start.CFrame
			        newMob.Parent = workspace
			    else
			        warn ("Requested mob does not exist:",name)
			    end
		end
	 
	return mob

Or this other script?

local zombie=script.Parent
local waypoints = workspace.Waypoints

for waypoint=1, #waypoints:GetChildren() do
	zombie.Humanoid:MoveTo(waypoints[waypoint].Position)
zombie.Humanoid.MoveToFinished:Wait()
end

1 answer

✓ Accepted answer

In your first script there isn't any reason to have the end on the last line. Any time you see eof in your error message you can assume that you did something wrong with your end placements. A working script would just be this:

local mob = require(script.mob)

local map = workspace.Thickboard

mob.Spawn("Zombie",map, 4 )

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