Character falls through the map

Hello everyone!

I was making my matchmaking system for my game and I ran into this bug.

the bug occurs after I teleport all my players to the map. I’ve looked in other forums and places, but nothing necessarily matches my case.

Note: this does not occur when I reset in the lobby, only when the players are teleported.

In detail, when I try to reset after the round system teleports me into the map, it makes my character fall down to the void.

Video:

External Media

(I apologize the video for not loading, for some reason, roblox didn’t allow me to upload the file to here.)

I think it may be an engine-related bug, but I’ll still show my scripts if necessary.

Round System Script:

local players = game:GetService("Players")
local replicatedstorage = game:GetService("ReplicatedStorage")
local serverstorage = game:GetService("ServerStorage")

local meleefolder = serverstorage.Melee:GetChildren()
local rangedfolder = serverstorage.Ranged:GetChildren()
local specialfolder = serverstorage.Special:GetChildren()

local remotesfolder = replicatedstorage.Remotes
local intermission_re = remotesfolder.Intermission
local timer_re = remotesfolder.Timer

local mapsfolder = serverstorage.Maps:GetChildren()

--// settings

local min_plrs = 1

--// game-functions

while task.wait() do
	
	-- check player-count
	
	repeat task.wait(1)
		warn("Not enough players!")
		intermission_re:FireAllClients("Not enough players!")
	until players.NumPlayers >= min_plrs
	
	print("Enough players to start the game!")
	
	-- enough player count to begin the game
	
	-- Intermission countdown
	
	intermission_re:FireAllClients("Intermission..", true)
	
	task.wait(1)
	
	for i = 10, 1, -1 do
		intermission_re:FireAllClients("Intermission: "..i)
		task.wait(1)
	end
	
	-- Picking random map
	
	local random_map = mapsfolder[math.random(1,#mapsfolder)]:Clone()
	random_map.Parent = workspace
	
	intermission_re:FireAllClients("Picking a random map..")
	
	task.wait(2.5)
	
	intermission_re:FireAllClients("Map Chosen: "..random_map.Name)
	
	task.wait(2.5)
	
	intermission_re:FireAllClients("Teleporting players..")
	
	task.wait(1)
	
	local spawnpoints = random_map:FindFirstChild("SpawnPoints")
	
	if spawnpoints then
		print("SpawnPoints found!")
	else
		warn("SpawnPoints not found!")
	end
	
	local availablespawnpoints = spawnpoints:GetChildren()
	
	local plrs = {}
	
	for _, player in pairs(players:GetPlayers()) do
		if player then
			local char = player.Character
			local hrp = char.HumanoidRootPart
			local hum = char.Humanoid
			
			
			local random_melee = meleefolder[math.random(1,#meleefolder)]:Clone()
			local random_ranged = rangedfolder[math.random(1,#rangedfolder)]:Clone()
			local random_special = specialfolder[math.random(1,#specialfolder)]:Clone()
			
			random_melee.Parent = player.Backpack
			random_ranged.Parent = player.Backpack
			random_special.Parent = player.Backpack
			
			table.insert(plrs, player)
			
			for _, tool in pairs(player.Backpack:GetChildren()) do
				if tool.Name == "Beachball" and tool:IsA("Tool") then
					tool.Parent = workspace.Lobby
					tool.Ball.CFrame = workspace.Lobby.BeachballSpawn.CFrame
				end
			end
			
			for _, tool in pairs(char:GetChildren()) do
				if tool.Name == "Beachball" and tool:IsA("Tool") then
					tool.Parent = workspace.Lobby
					tool.Ball.CFrame = workspace.Lobby.BeachballSpawn.CFrame
				end
			end
			
			if char then
				hrp.Position = availablespawnpoints[1].Position + Vector3.new(0,5,0)
				table.remove(availablespawnpoints, 1)
			end
		end
	end
	
	intermission_re:FireAllClients("Starting", false)
	
	timer_re:FireAllClients(120)
	
	task.wait(120+2)
	
	print("Game Ended")
	
	random_map:Destroy()
	
	for i, player in pairs(plrs) do
		if player then
			player:LoadCharacter()
		end
	end
	
end

Keep in mind that the script here isn’t fully finished yet, so I’ve put some placeholders for now.

The other two scripts that may have an impact are my Ragdoll script, and my collision script. The collision script just enables collision when the humanoid dies.

I’ve used the ragdoll script before, and I can say it’s most likely not the main cause, but I can show the script if necessary.

2 Likes

you should change this line to

hrp.CFrame = CFrame.new(availablespawnpoints[1].Position + Vector3.new(0,5,0))

I don’t know if this helps but try it

1 Like

I opened studio again, posted this line and tried, it apparently worked. I doubt this really made it work but I appreciate the help.

1 Like

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