Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Benqazx 108
8 years ago
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?

0
Doesn't crash when I use it. DragonODeath 50 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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

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. DragonODeath 50 — 8y
0
it has a wain in the script. line 14 Benqazx 108 — 8y
0
@DragonODeath that might be it Benqazx 108 — 8y
Ad

Answer this question