NPC stuck in air after being returned from server storage

hello, im making shooter game where “death” is being police custody
game have AI Crew (bots)
my police custody working just fine with players,
but i got some issue which i dont know how to fix

when BOT being traded back from custody, it stucks in air

so when bot’s HP reaching zero, bot is being knocked out, with countdown starting,
when this countdown reached zero, bot being taken into custody, and needs to be traded back using hostages.

when bot ends up in custody, bot’s model parent sets to game.ServerStorage.custody

and there’s problem: after being traded back, (bot model’s parent set back to workspace.bots) bot just stucks in air.

image:
изображение

code where issue starts:

for _,v in pairs(data.BotsInCustody) do
	if v.Bot == BotTable.Bot then
		if v.Bot and BotTable.Bot then
			v.Bot.downing.server_revive:Fire(player_who_traded) -- revive by server
			v.Bot.Parent = workspace.bots -- game.ServerStorage.custody -> workspace.bots
			v.Bot:MoveTo(player_who_traded.Character.PrimaryPart.Position)
			game.ReplicatedStorage.hud.ui.show_server_hint:FireAllClients(BotTable.Bot.Name.." was released from custody thanks to "..player_who_traded.Name.."!")
			v.Bot = nil
			v.Position = nil
			break
		else
			continue
		end
	else
		continue
	end
end
2 Likes