Enemies falling on spawn on live servers only

You can write your topic however you want, but you need to answer these questions:

  1. I want to stop enemies ocassionally falling down when they spawn in on live servers

  2. Some enemies that are spawned in via serverstorage ocassionally fall down or don’t move for a few seconds after spawning in but work completely fine when I test my game in studio.

  3. I’ve tried rasing and lowering the spawn positions and setting the spawn position bricks orientation to (0,0,0).

This is how the enemies are suppose to work.

This is how they work when playing on LIVE servers

As you can see the difference is night and day, in studio the enemies instantly spawn in and charge at the player, while on live servers the enemies occassionally spawn in and wobble around / fall over, and in the case of my ranged enemies they fall down and struggle to get back up. I’ve viewed similar topics that touch on adjusting hip height, the orientation of the spawn points, and the height of the spawns but everything works perfectly in studio tests still but not on an actual server, which makes this extremely frustrating to test. If anyone has ran into this or has any solutions I’d appreciate the help. I’ve also included my spawning script below as well.

local part = script.Parent
local spawnZone = game.Workspace.Spawns.ForestSpawn6
local spawnZone2 = game.Workspace.Spawns.ForestSpawn7

local ServerStorage = game:GetService('ServerStorage')

local canSpawn = true

local function spawnZombie(otherPart)
	local humanoid = otherPart.Parent:FindFirstChildWhichIsA('Humanoid')
	local player = game.Players:FindFirstChild(otherPart.Parent.Name)
	if humanoid and player and canSpawn then
		canSpawn = false
		local zombie = ServerStorage.Enemies['Bandit Ambusher']:Clone()
		local zombie2 = ServerStorage.Enemies['Bandit Ambusher']:Clone()
		zombie.Parent = game.Workspace.Enemies
		zombie.HumanoidRootPart.CFrame = CFrame.new(spawnZone.Position)
		zombie2.Parent = game.Workspace.Enemies
		zombie2.HumanoidRootPart.CFrame = CFrame.new(spawnZone2.Position)
		wait(50)
		canSpawn = true
	end
	
end

part.Touched:Connect(spawnZombie)

try disabling ROBLOX’s built in “ragdoll” which is when the character just falls flat on their face

humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)

https://create.roblox.com/docs/reference/engine/enums/HumanoidStateType

It looks like the problems may be related to the CFrame. It appears that your CFrame is not properly positioning the spawned enemies. To fix this, try adjusting the orientation of the spawn points, as well as the height of the spawns. Additionally, you could try setting the hip height of the spawned enemies to be higher so they are less likely to fall down. Finally, you could try adding a delay to the spawning process to give the enemies more time to properly adjust their position before they start moving.

1 Like

So this is the script i drafted up and ended up using, it had no effect on the melee enemies I put it in but it completely fixed my ranged enemies falling down completely. I’m unsure why it doesn’t effect my melee enemies though.

local char = script.Parent;
local hum = char:WaitForChild("Monster")


hum.StateChanged:Connect(function(oldState, newState)
	hum:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
	hum:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
end)

Hey,

As I stated in my original post I’ve tried adjusting the CFrame by playing around with the spawns heights and setting the orientation to all spawn points in my game to (0,0,0). Also, I’ve fiddled around with hip height but i can’t raise it further without the Enemies starting to float. However, your suggestion to delay the spawning process is quite interesting and could possibly work. The way I’m thinking of executing this does sound a bit rough though which is as follows, I’d spawn the enemy somewhere offscreen and after a 1-2 Second delay teleport it to it’s actual spawn point. Would there be a cleaner way of implementing this?

local zombie = ServerStorage.Enemies['Bandit Ambusher']:Clone()
		local zombie2 = ServerStorage.Enemies['Bandit']:Clone()
		wait(1)
		zombie.Parent = game.Workspace.Enemies
		zombie.HumanoidRootPart.CFrame = CFrame.new(spawnZone.Position)
		zombie2.Parent = game.Workspace.Enemies

As suggested I added a 1 second delay to the spawning and the problem was fixed, thanks for the help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.