Ad
Log in to vote
0

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

Asked by 15 days ago

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

Log in to vote
0
Answered by 15 days ago

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 )
Ad

Answer this question