I originally wasn’t going to make a whole report about this but it feels important as this can make new developers quit if another developer puts a curtain line of code in their game.
The line of code below will use up all your memory and will have a 50% chance of soft locking you and 50% chance of crashing. Simply click play and then click stop.
game:GetService('PathfindingService'):CreatePath({WaypointSpacing = 0}):ComputeAsync(Vector3.new(0,0,0), Vector3.new(1,0,0))
It is best to put this line of code in a baseplate to not lose any progress. Save all opened places just to make sure.
Why is this important?
This is an oversight. Roblox is all about making it easy for beginners to get the hang of coding and creating games. A Roblox made method should not be causing this much problems. Normally there are safety guards to prevent crashes, such as when you run a “while do loop” it will error after a while so you don’t crash. This could also be harmful if a bad actor places this in a game and no other developers will know why it is crashing, they will just give up on the game or studio itself.
Before anyone asks, I am pretty sure this is not PC related as running the code above may yield similar results. If people having trouble getting the crash to work I may put my PC details here.
Expected behavior
Possible fixes would be:
- Have a error message if the WaypointSpacing is close to 0
- Limit the amount of memory a single path can take up.
Any fix really that doesn’t make my computer run out of memory and fans spinning at max speed.