Raycast is stops working after player is teleported

Ok so, I have a weapon that only deals damage to players when the round starts, and everything else should work, it just shouldn’t deal damage. It all works fine, but once the player gets teleported into the new round, the raycasts results just stop working all together, and I really don’t get it.

Here is the code for the weapon, it works fine before the round, but once the round starts, it prints the “No Result” part

local handlePosition = script.Parent.Handle.Position
		local result = workspace:Raycast(handlePosition, (mouseHit - handlePosition).Unit * range, params)
		print(result)
		--Shoots the raycast.
		--Direction is equal to orgin minus endposition, then .Unit * range.
		--If it found something.
		print("raycast")
		if result then
			print("before result")
			script.Parent.pistolHole:FireClient(player, result, result.Instance, result.Position, result.Normal)
			print("Hit something")
			--The part it hit,
				local hitPart = result.Instance
			if hitPart then
					print("HIT PART")
					local char = hitPart.Parent
					local humanoid = char:FindFirstChild("Humanoid")
					if char.Name ~= player.Name and humanoid then --If its a humanoid and its not the holders humanoid.
						print("Hit someone")
						if pistolwork.Value == true then --Part that checks if the round has started, but this shouldn't affect anything!!
						print("shot it with damage")
						humanoid:TakeDamage(100)
						else
						print("couldnt shoot it though")
						end
						print("Playign sound")
						script.Parent.RemoteEvent:FireClient(player)
					end
			end
		else
			print("No result")
		end
			

The gun works perfectly, but as soon as the player gets teleported, it stops getting a result.

Here is an image, just so you know, NOTHING changes the pistol at all.
image

edit: I’ve tested it with different guns, and they also stop working. I’ve decided to provide my script that controls the rounds.

game.Players.PlayerAdded:Connect(function(player)
	local i = Instance.new("BoolValue")
	i.Name = "InMenu"
	i.Value = true
	i.Parent = player
	player.CharacterAdded:Connect(function(char)
		if player:WaitForChild("InMenu").Value == true then
			char:WaitForChild("Humanoid").WalkSpeed = 0
		end
		char.Humanoid.Died:Connect(function()
			for i, v in pairs(ingamePlayers) do
				if v.Name == player.Name then
					currentPlayers -= 1
					table.remove(ingamePlayers, i)
					playerDies = true
					playerDeath = player.Name
				end
			end
			changeMusic:FireClient(player, "Lobby")
		end)
		--player.CameraMode = Enum.CameraMode.Classic
		--player.CameraMinZoomDistance = 12
		--player.CameraMaxZoomDistance = 12
		
		local i = weapon:Clone()
		i.Parent = player.Backpack
	end)
end)

while true do
	changeMusic:FireAllClients("Lobby")
	pistolWork.Value = false
	playerDies = false
	table.clear(ingamePlayers)
	currentPlayers = 0
	
	for i = intermissionTime, 0, -1 do
		topText.Value = i.. "s"
		task.wait(1)
	end
	topText.Value = "Loading map..."
	map = maps[math.random(1, #maps)]:Clone()
	map.Parent = workspace.CurrentMap
	task.wait(2)
	topText.Value = map:FindFirstChild("Settings"):FindFirstChild("mapName").Value.. " was chosen as the map."
	task.wait(4)
	topText.Value = "Game starting..."
	task.wait(1)
--Probably bugs after this point
	for i, v in pairs(game.Players:GetPlayers()) do
		if v:FindFirstChild("InMenu").Value == false then
			currentPlayers += 1
			table.insert(ingamePlayers, v)
		end
	end
	for i, v in pairs(ingamePlayers) do
		local char = v.Character
		if char then
			
			char:FindFirstChild("Humanoid").WalkSpeed = 0
		
			print("Set WalkSpeed")
			local rootPart = char:FindFirstChild("HumanoidRootPart")
			if rootPart then
				local points = map:FindFirstChild("Mappoints"):GetChildren()
				
				local pos
				pos = points[math.random(1, #points)]
				rootPart.Position = pos.Position
				pos:Destroy()
				
				
			end
		end
		char:FindFirstChild("Humanoid").WalkSpeed = 0
	end
	changeMusic:FireAllClients("Stop")
	task.wait(2)
	topText.Value = "3"
	task.wait(1)
	topText.Value = "2"
	task.wait(1)
	topText.Value = "1"
	task.wait(1)
	topText.Value = "Go!"
	changeMusic:FireAllClients("Game")
	for i, v in pairs(ingamePlayers) do
		local char = v.Character
		if char then
			local hum = char:FindFirstChild("Humanoid")
			if hum then
				hum.WalkSpeed = 10
			end
		end
		pistolWork.Value = true
	end
	task.wait(1)
	
	local timeLeft = gameTime
	repeat 
		
		
		if playerDies == false then
			timeLeft -= 1
			topText.Value = timeLeft.. "s"
			task.wait(1)
		elseif  playerDies == true then
			game.Workspace.DeathSound:Play()
			topText.Value = playerDeath.. " has died..."
			task.wait(3)
			playerDies = false
			timeLeft -= 3
		end
	until currentPlayers <= 1 or timeLeft <= 0
	topText.Value = "Game over!"
	pistolWork.Value = false
	task.wait(1)
	for i, v in pairs(ingamePlayers) do
		local char = v.Character
		if char then
			local root = char:FindFirstChild("HumanoidRootPart")
			if root then
				root.Position = spawnpoints[math.random(1, #spawnpoints)].Position
				
			end
		end
		
	end
	changeMusic:FireAllClients("Lobby")
	map:Destroy()
	if currentPlayers <= 0 or currentPlayers > 1 then
		topText.Value = "Nobody won!"
	elseif currentPlayers == 1 then
		local plr
		for i, v in pairs(ingamePlayers) do
			plr = v
			--v.CameraMode = Enum.CameraMode.Classic
			--v.CameraMinZoomDistance = 12
			--v.CameraMaxZoomDistance = 12
			
			break
		end
		topText.Value = plr.Name.. " has won the game!"
	end
	pistolWork.Value = false
	task.wait(5)
	
end