I have a zombie loader script that respawn player whenever the player switched team. Usually when the players reset, their character will be respawn as normally, but i just discovered a new error that causing the players stucking in the void. Basically, when the player’s character fall into the void, they will end up stucking, this bug happens even player is not on the “zombies” team, and i don’t know how to solve this
Here is my script
local zombieteam = game.Teams.Zombies
local players = game:GetService("Players")
local mutations = game.ServerStorage:FindFirstChild("Mutations"):GetChildren()
players.CharacterAutoLoads = false
local spawntime = 5
local function randomize()
local randomIndex = math.random(1, #mutations)
local mut = mutations[randomIndex]
return mut:Clone()
end
local function copyAccessories(player, newZombie)
local character = player.Character or player:LoadCharacter()
if character then
for _, accessory in pairs(character:GetChildren()) do
if accessory:IsA("Accessory") then
local clonedAccessory = accessory:Clone()
clonedAccessory.Parent = newZombie
end
end
end
end
local function spawnZombieWithAccessories(player)
local newZombie = randomize()
newZombie.Name = player.Name
for _, script in pairs(game.StarterPlayer.StarterCharacterScripts:GetChildren()) do
local clonedScript = script:Clone()
clonedScript.Parent = newZombie
end
copyAccessories(player, newZombie)
player.Character = newZombie
newZombie.Parent = workspace
newZombie.HumanoidRootPart.CFrame = workspace["z team spawn"].CFrame + Vector3.new(0,1,0)
end
local function spawning(player)
if player.Team == zombieteam then
spawnZombieWithAccessories(player)
else
player:LoadCharacter()
local normalanimate = script.Animate:Clone()
normalanimate.Parent = player.Character
end
end
local function adding(player)
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
humanoid.Died:Connect(function()
wait(spawntime)
spawning(player)
end)
end)
spawning(player)
end
players.PlayerAdded:Connect(adding)
for _, player in pairs(players:GetPlayers()) do
player:GetPropertyChangedSignal("Team"):Connect(function()
spawning(player)
end)
end
players.PlayerAdded:Connect(function(player)
player:GetPropertyChangedSignal("Team"):Connect(function()
spawning(player)
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
if player.Team == zombieteam then
local zombie = workspace:FindFirstChild(player.Name)
if zombie then
zombie:Destroy()
end
end
end)
Since player cannot respawn whenever they fell, this bug will be critical to the game.
This is the rigs i used, its pretty much the same to the roblox’s default rig
it does have a motor6d called neck, but the error im facing here is when the player fall to the void, which it removes all of the player parts and such
So i end up using a detector that if the player fell into any areas that is too deep then it will kill the player, which i find out helpful on preventing hacker
you should make a map range detector, (if the range is greater then 1000 then kill the player) and also make the deletion barrier lower(click on workspace edit the height in properties). Also, using a “detector part” can be easily bypassed by disabling .cantouch by a hacker.
And last but not least: try and barrier the map off, open voided maps dont look as good as the ones that are closed in.
you mean that you check if the humanoid root part Y is Less then -3500? since it would kill you at y axis 0 if you use greater than. Anyways, you should maybe also make a barrier around the map? (houses or smth like i said earlier) since (again) open voided maps look ugly and i know this from experience.