I am trying to make a tower defense game. I write some code to make the zombies spawn into the map but for some reason it says " ServerScriptService.Main.mob:2: Expected ')' (to close '(' at line 1), got " and " Attempted to call require with invalid argument(s)".... I do not know what it means and it's the only thing preventing my code from working. Please help.
Here's the code:
local mob = require(script.mob)
local map = workspace.Thickboard
mob.Spawn("Zombie",map )
And some more code in a second 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)
return mob

1 comment
Thanks man. Awesome.