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

My code works fine until the function?

Asked by
SS547 0
2 years ago

So Im new to scripting I barely know anything so when I want to do or learn things I go and find a tutorial. I was following along this tutorial https://youtu.be/6C9-Hud4UiY but my function did not run and it had no errors. So I added prints to find where it stopped working and it just stops working when it comes to function I tried everything that came into my mind but couldn't find a soliton could you guys help me?

Heres The Code: https://pastebin.com/JTUYh0vL

It stops working when it comes to line 23

1 answer

Log in to vote
0
Answered by 2 years ago

You called the function on the wrong thread. The function can't be called because you called the function in the function, so it couldn't even run. You have to call the function outside of the function.

I also noticed that you are using wait() and spawn(). Try using task.wait() and task.spawn() instead, as they are more performant than the others. task.wait() and task.spawn() are a part of a library called the task library, which are more performant than their counterparts outside of the task library.

0
uh, no they clearly called the end of the function at line 38??? but yeah your right abt the last part LeoPlaysGames_RBX 26 — 2y
0
You must've read the function wrong. When put into Roblox Studio, the end of the function is actually at line 83. The end at line 38 is a part of an if statement that starts at line 32. They then call the function 50 times using a for loop, but the for loop is in the function itself. SpiritualSonicdash 67 — 2y
Ad

Answer this question