Random crashes again

Crash log: https://thelonelydev.stackstorage.com/index.php/s/DDYa1ST30lG63Y6

Place it occurs at: https://www.roblox.com/games/35031023/NEW-The-Robloxian-Army-Recruitment-Center

Not sure what causes it, maybe audio related? ( @spotco )

It’s sound related.
Is there something specific you have to do to trigger it?

RE: This is from a really old client version (3 weeks ago).
Can you still make it happen?

It were my crash logs from 2-3 days ago; it still happens but it is very random as we tested today with some people but due to it’s “random nature” it’s hard to replicate on your own client. (Partixel and me are in the same “dev group”.)

The sounds are used in a gun system (made by Partixel), they are used for firing/hitting/'bullet passing"/wind-up etc.

If this helps, https://www.roblox.com/library/192712402/Surge-2-0-Modules are the modules and the sounds are being used by Shared > Visuals

(Correct me if I’m wrong @Partixel.)

Is there a specific weapon that you think crashes it, or is having trouble?

1 Like

From my experience from the crashes that I have seen, it really isn’t a specific weapon that leads to this behaviour :s

I’m now crashing with the “An unexpected error occurred and ROBLOX needs to quit. We’re sorry!” message whenever I join any game.

1 Like

This is unrelated and should now be resolved.

I’ll see if I can get someone to send me a newer crash log

Just got sent this, I’m not sure if it’s the correct logs or not but hopefully it is:


Anything I can do on my end to prevent these crashes?

Found a repro:

Crashes occur for me after a few seconds to a few minutes, kind of random.

If it doesn’t crash you, rejoin / keep trying :frowning:

EDIT: Also here’s the logs from when I crashed a few minutes ago ( my first time personally ):


I’ll take a look.

Looked into it and it may be sound related.
Are you doing anything very odd with SoundService or Sounds to destroy them?

I’m unable to get the crash to happen on either one of my computers.
Are you able to get it consistently? And if so, can you give more detailed steps?

Unfortunately it seems to happen at random intervals and some times not at all.

As far as sounds go I’m cloning sounds from a ModuleScript within ReplicatedStorage and then playing it from either a StarterGui / Part in the camera and destroying them via Sound.Ended:connect( function ( ) Sound:Destroy( ) end )

Here is some of the code in which this happens:

local function AtPos( Position )
	local Part = Instance.new( "Part", workspace.CurrentCamera )
	Part.Name = "AtPos"
	Part.CanCollide = false
	Part.Transparency = 1
	Part.Size = Vector3.new( )
	if pcall( function ( ) return Position:IsA( "BasePart" ) end ) then
		Part.Anchored = false
		local Weld = Instance.new( "Weld", Part )
		Weld.Part0 = Part
		Weld.Part1 = Position
		Part.Anchored = true
		Part.CFrame = Position
	return Part

local function PlaySoundAtPos( Position, Sound )
	local SoundObj = script[ Sound ]:Clone( )
	local Par1 = AtPos( Position )
	SoundObj.Parent = Par1
	Par1.Name = "SoundPart"
	SoundObj.Volume = SoundObj.Volume
	SoundObj:Play( )
	SoundObj.Ended:connect( function ( )
		Par1:Destroy( )
	end )
Core.Visuals.FlyBy = Core.SharedVisuals.Event:connect( function ( StatObj, User, Barrel, Hit, End, Normal, Material, Offset, BulNum, Humanoids )
	if not Barrel or not StatObj or not StatObj.Parent then return end
	if User == Players.LocalPlayer then return end
	local Pos = workspace.CurrentCamera.CFrame.p
	local Start = Barrel.Position
	if ( Start - Pos ).magnitude > ( End - Start ).magnitude + 50 then
	local Ray = Ray.new( Start, CFrame.new( Start, End ).lookVector ).Unit
	local ClosestPoint = Ray:ClosestPoint( Pos )
	local Distance = Ray:Distance( Pos )
	if ( Start - Pos ).magnitude > ( End - Start ).magnitude then
		Distance = ( End - Pos ).magnitude
		ClosestPoint = End
	if Distance < 50 then
		PlaySoundAtPos( CFrame.new( ClosestPoint ), "Flyby" .. math.random( 1, 4 ) )
end )
Core.Visuals.BarrelEffects = Core.SharedVisuals.Event:connect( function ( StatObj, User, Barrel, Hit, End, Normal, Material, Offset, BulNum, Humanoids )
	if not Barrel or not StatObj or not StatObj.Parent then return end
	if ( workspace.CurrentCamera.CoordinateFrame.p - Barrel.Position ).magnitude > 100 then return end
	local GunStats = Core.GetGunStats( StatObj )
	local Part, Wait = GetVisualBarrel( Barrel )
	if ( BulNum == 1 or GunStats.DelayBetweenShots ~= 0 ) and GunStats.FireSound then
		local FireSound = GunStats.FireSound:Clone( )
		FireSound.Parent = Part
		FireSound:Play( )
		FireSound.Ended:connect( function ( )
			FireSound:Destroy( )
		end )
end )
Core.Visuals.BulletImpactSound = BulletArrived.Event:connect( function( BulletType, Barrel, End, Hit, Normal, Material, Offset, Humanoids )
	if not Hit then return end
	if BulletType and BulletType ~= "Kinectic" then return end
	local HitSound = "BulletHitConcrete"
	local HitPos = Hit.CFrame:pointToWorldSpace( Offset or Vector3.new( ) )
	local Humanoid = DamageUtil.GetValidHumanoid( Hit )
	if Humanoid and Humanoid:IsA( "Humanoid" ) and DamageUtil.CheckTeamkill( Players.LocalPlayer, Humanoid ) then
		HitSound = "BulletHitFlesh"
	elseif Material == Enum.Material.Metal or Material == Enum.Material.CorrodedMetal or Material == Enum.Material.DiamondPlate then
		HitSound = "BulletHitMetal"
	elseif Material == Enum.Material.Wood or Material == Enum.Material.WoodPlanks then
		HitSound = "BulletHitWood"
	elseif Material == Enum.Material.Glacier or Material == Enum.Material.Ice or Material == Enum.Material.Neon or Hit.Transparency > 0 then
		HitSound = "BulletHitGlass"
	if ( workspace.CurrentCamera.CoordinateFrame.p - HitPos ).magnitude > 200 then return end
	PlaySoundAtPos( CFrame.new( HitPos ), HitSound )
end )
1 Like

Got it, that’s helpful.
My guess is that it could be something related to destroying sounds on ended? There was a bug similar to this that should have been fixed.

(So if you want to stop the crashes “for now”, try waiting the length of the sound and then destroying it instead of doing it on the event. Let me know if that works.).

1 Like

Seems to have fixed it so far, but as I’ve said, the crashes don’t always happen within the first few minutes so I’ll post here again if it does eventually crash.