Hi there! I’m trying to make a tower defense game and I got this problem when it occurred when the enemies spawned.
-
What do you want to achieve?
I tried to make this custom character of mine walking on a path smoothly
-
What is the issue?
It keeps getting stuck on nothing.
-
What solutions have you tried so far?
I Tried moving the Waypoints back and forth, Check is there any invisible parts in the map, and checking the model of the character perhaps is there collision problem. All that i got is that this is a collision problem because sometimes its stuck for a sec and then continue walking, It feels like there is something that stop the characters to move. And, this problem is always happening on Bigger Characters.
Oh yea, Idk where is the record feature for roblox studio, so I just provide screenshots
Tell me if you need anything to solve my problem! Thank You <3
Sorry if it takes too long to reply, But here is some more information on how the NPCs works
- Here is the code that use to Spawn the NPCs and how the NPCs Move
function mob.Move(mob, map, movingToVal)
local humanoid = mob:WaitForChild("Humanoid")
local waypoints = map:WaitForChild("Waypoints")
local offset = Vector3.new(math.random(-100,100)/100, 0, math.random(-100,100)/100)
if movingToVal == nil then
for waypoint = 1, #waypoints:GetChildren(), 1 do
mob.MovingTo.Value = waypoint
repeat
humanoid:MoveTo(waypoints[waypoint].Position + offset)
until humanoid.MoveToFinished:Wait()
end
else
for waypoint = movingToVal, #waypoints:GetChildren(), 1 do
mob.MovingTo.Value = waypoint
repeat
humanoid:MoveTo(waypoints[waypoint].Position + offset)
until humanoid.MoveToFinished:Wait()
end
end
mob:Destroy()
workspace.GameInfo.Enemies.Value -= 1
map.Base.Humanoid:TakeDamage(humanoid.Health)
end
function mob.Spawns(name, quantity, map)
local mobExists = serverStorage.Mob:FindFirstChild(name)
workspace.GameInfo.Enemies.Value += quantity
print(quantity)
if mobExists then
for i = 1, quantity, 1 do
wait(0.55)
local newMob = mobExists:Clone()
newMob.Parent = workspace.Mobs
newMob.HumanoidRootPart.CFrame = map.Start.CFrame
newMob.HumanoidRootPart:SetNetworkOwner(nil)
local movingTo = Instance.new("IntValue")
movingTo.Name = "MovingTo"
movingTo.Parent = newMob
for i, object in ipairs(newMob:GetDescendants()) do
if object:IsA("BasePart") then
object.CollisionGroup = "Mobs"
end
end
-- Special Mobs
if newMob.Name == "Gateway" then
newMob.Config.SheildHP.Changed:Connect(function()
if newMob.Config.SheildHP.Value <= 0 then
newMob.Name = "Builder"
local explosion = Instance.new("Explosion", newMob.HumanoidRootPart)
explosion.Position = newMob.HumanoidRootPart.Position
explosion.DestroyJointRadiusPercent = 0
explosion.BlastPressure = 0
newMob.HumanoidRootPart.Explosion:Play()
newMob.Portal:Destroy()
newMob.Script:Destroy()
newMob.Humanoid.WalkSpeed = 0
newMob.Config.Defense.Value = 15
animMobEvent:FireAllClients(newMob, "Shock")
wait(1.5)
animMobEvent:FireAllClients(newMob, "BuildWalk")
newMob.Humanoid.WalkSpeed = 5
end
end)
end
-- Death Situation
newMob.Humanoid.Died:Connect(function()
if newMob:FindFirstChild("Config") then
local mobType = newMob.Config.Type.Value
if mobType == "Bomb" then
mob.Explode(newMob, newMob.Config.Radius.Value, map)
end
end
wait(1)
newMob:Destroy()
workspace.GameInfo.Enemies.Value -= 1
end)
coroutine.wrap(mob.Move)(newMob, map)
end
else
warn("Requested mob doesn't exists: ", name)
end
end
- Here is the recording of the NPC getting stuck
Client Perspective
Server Perspective
I tried using your script, but I got is this Malfunction
Because of this the enemy somehow just died before reaching the final waypoint, so the round ended too fast. And pretty sure its the StartWaypoint variable also one of the reason I think?
Also need add, some of my enemies doesn’t always spawns on the first waypoint
But yeah, thats what I got after testing your script
was the custom big character made in roblox studio
Yes, it was made in roblox studio
I tried adjusting the humanoid hipheight and i got is stop being stuck, but also it makes the NPC float.
I guess the best option for me is adding small wedges to ledges so that the npc stop being stuck.

did you build this character from scratch
Yes, but some of the mesh i take from toolbox, like accesories for the head and the back