Printing numbers in the output constantly can work in the short-term, however it has a lot of cons. One of the biggest being that it prevents you from seeing other information that isn’t being printed every frame. Another con is that it’s pretty hard to scroll up and see what happened a few frames ago since it’s scrolling so fast.
(related: Let us plot graphs for debugging)
To resolve this problem, I have decided to create PlotTwist.
Insert the module into your game, and require it in your script:
local plotUtil = require(PATH_TO_PLOT_UTIL)
Now we can use PlotUtil’s functions. Here’s an example script that should roughly show you how to use it:
local plotUtil = require(PATH_TO_PLOT_UTIL) local graph = plotUtil:CreateGraph("EpicGraph") -- you can name your graph whatever you want while true do local x = time() local y = math.sin(time()) * 50 plotUtil:NewPoint(graph, x, y) wait(.1) end
Let’s run it. If you go into play mode and turn on the plugin widget, you should see this:
Type the name of the graph you want to view. In this case, it’s “EpicGraph”:
Now we can see a sine wave! This means that everything is working as intended.
You can also do stuff like plotting character movement, mouse movement, etc. You can plot pretty much everything with this.
Instance PlotUtil:CreateGraph(string graphName) -- create a graph that can be viewed on the plugin PlotUtil:NewPoint(Instance graphFolder, float x, float y) -- create a point on a graph
Note that you should try firing NewPoint less than 10 times a second, any more gets very laggy very quickly.
Have fun programming with this plugin! Feedback is appreciated too.
(PlotUtil source pastebin because someone asked me to make it: PlotUtil - Pastebin.com)