Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

why does my roblox studio crash when i use this script?

while true do
	path = game:GetService("PathfindingService"):ComputeRawPathAsync(game.Workspace.Start.Position, game.Workspace.Finish.Position, 512)
	points = path:GetPointCoordinates()
	game.Workspace.Points:ClearAllChildren()
	for i=1, #points do
		part = Instance.new('Part')
		part.Size = Vector3.new(1,1,1)
		part.FormFactor = Enum.FormFactor.Symmetric
		part.CanCollide = false
		part.Position = points[i]
		part.Anchored = true
		part.Parent = game.Workspace.Points
	end
	wait(0.1)
end

my roblox studio crashes when i use this script. everytime i try to move my finish to a different position or add a part my studio crashes. why?

1 comment

0

Doesn't crash when I use it.

1 answer

I'm sorry I don't know if what I am about to say is going to fix your problem completely since I don't really know what you have in the workspace or inside of your game. However, try putting a wait() inside of the for loop and see if that changes anything if not then I am not sure as to why it would do that...

Thank you and sorry I couldn't help you any better.

~~KingLoneCat

3 comments

0

Putting in a wait() wouldn't achieve anything other than a 1/30 second yield. He already has a wait(0.1) in his loop to prevent a crash from infinite loop. It's probably just that his computer can't handle the generation of the path.

0

it has a wain in the script. line 14

0

@DragonODeath that might be it

This discussion is preserved as it was. New answers, comments, and votes are closed.