I was scripting a tower defence game when I got this error it happened in all 3 of my scripts
happens on these lines of code, be aware that the mob script is the module
Mob:
object:IsA(“BasePart”) then
coroutine.wrap(mob.Move)(newMob, map)
Also happens with the else near the bottom of the script
OnPlayerAdded:
object:IsA(“BasePart”) then
end)
If you need here is the full script
local Players = game:GetService("Players")
local PhysicsService = game:GetService("PhysicsService")
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
for i, object in ipairs(character:GetDescendants()) do
object:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(character, "Mob")
end
end
end)
end)
And another one
local PhyicsService = game:GetService("PhysicsService")
local ServerStorage = game:GetService("ServerStorage")
local mob = {}
function mob.Move(mob, map)
local humanoid = mob:WaitForChild("Humanoid")
local waypoints = map.Waypoints
for waypoint=1, #waypoints:GetChildren() do
humanoid:MoveTo(waypoints[waypoint].Position)
humanoid.MoveToFinished:Wait()
end
mob:Destroy()
end
function mob.Spawn(name, quantity, map)
local mobExists = ServerStorage.Mobs:FindFirstChild(name)
if mobExists then
for i=1, quantity do
task.wait(0.5)
local newMob = mobExists:Clone()
newMob.HumanoidRootPart.CFrame = map.Start.CFrame
newMob.Parent = map.Mob
for i, object in ipairs(newMob:GetDescendants()) do
object:IsA("BasePart") then
PhyicsService:SetPartCollisionGroup(newMob, "Mob")
end
end
coroutine.wrap(mob.Move)(newMob, map)
end
else
warn("Requested mob does not exist:", name)
end
end
return mob
If you can help please comment