Studio in game crash

After a lot of shots with an assault rifle, my studio just freezes. I need to find out how to see studio crashes or look at the logs to find out what the error is. I have been trying to fix this for two weeks, please help :slight_smile:

I thought this was common sense, I guess not.

May you provide code for your assault rifle? Try to rule out irrelvant code, especially if it is too long. Like, what part of the code did you just work on that then started to crash studio?

1 Like

I dont want to share the code :frowning: Yes, and it is very huge and I tried to make it shorter, I shortened everything as much as I could.

Everything worked great, but after some small fixes (dont know which ones), the game started to crash, I dont think that the problem is in this particular code.

As @bluebxrrybot said, first things first. Since this is Scripting Support you need to supply the code you are having issues with.

What code did you change?

You also didn’t mention if you are you looking for any error messages in the Output window .

1 Like

Are there any errors before the game freezes? Or maybe just before the window closes? Also, theres a studio setting that allows you to change the script timeout limit. If you set this lower, you might be able to catch the error before it crashes completely.

1 Like

It freezes in the studio, in the game itself server scripts, events and all that stop working. Only local scripts work normally.

I cant look at the output, everything freezes. I tried to wait a long time but nothing

Try looking for a loop without a wait.

2 Likes

Sounds like you may have a loop in your latest script changes that doesn’t have a task.wait() in it.

1 Like

In addition to this, there is also possibly recrusion at play here. Such as events firing each other, modules requiring each other, or maybe functions calling itself or each other.

1 Like

Do you have a “while true do” loop?

1 Like

no, only while wait()do and while wait(time)do

May you test your game a little more to see what exactly causes the crashes? For example: A specific amount of bullets shot crashes the game? Reloading crashes? Needing to reload crashes? Walking crashes? etc.

1 Like

Tried, added wait() and optimized them but… still the same

EXACTLY. I added a module in which the function is called through an event. Like

event.OnServerEvent:Connect(function(plr,arg,arg2)
   func(ple,arg,arg2)
end)

I will ll try to fix them now

No good without a code snippet. So much seems logical with old eyes looking at old code. New eyes provide insight to areas where the brain interprets what it is reading/seeing and what is actually there

1 Like

Oh, you can connect the function directly by the way:

event.OnServerEvent:Connect(func)

You could also just move the ‘func’ function right into the event if you aren’t using it anywhere else.

1 Like

removed the module from scripts and:
Something unexpectely tried to set the parent of FireSound to NULL while trying to set the parent is wSounds. (x1265552) -- lol

The error was due to this script:

local way=workspace.wSounds
local max=90

way.ChildAdded:Connect(function(child)
   if #way:GetChildren>=max then
      way:ClearAllChildren()
   end
   task.wait(.5)
end

This error helped everyone finally understand the problem. I already fixed it and everything works fine

Thank you very much for solving the problem, Im very glad that I finally found out the solution!!

1 Like

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