I've set up this simple plugin, and what it should do is smooth a radius of terrain around where the mouse is pointed at. It print 'Click', but doesn't smooth.
01 | local plugin = PluginManager():CreatePlugin() |
02 | local toolbar = plugin:CreateToolbar( "Hello World Plugin" ) |
03 | local terrain = Game.Workspace.Terrain |
04 |
05 | local smoothButton = toolbar:CreateButton( |
06 | "Smooth" , |
07 | "Use this to smooth an area of terrain" , |
08 | "SmoothIcon.png" |
09 | ) |
10 |
11 | smoothButton.Click:connect( function () |
12 | plugin:Activate( true ) |
13 | local mouse = plugin:GetMouse() |
14 | mouse.Button 1 Down:connect( function () |
15 | local mosPos = mouse.Hit |
01 | local plugin = PluginManager():CreatePlugin() |
02 | local toolbar = plugin:CreateToolbar( "Hello World Plugin" ) |
03 | local terrain = Game.Workspace.Terrain |
04 |
05 | local smoothButton = toolbar:CreateButton( |
06 | "Smooth" , |
07 | "Use this to smooth an area of terrain" , |
08 | "SmoothIcon.png" |
09 | ) |
10 |
11 | smoothButton.Click:connect( function () |
12 | plugin:Activate( true ) |
13 | local mouse = plugin:GetMouse() |
14 | mouse.Button 1 Down:connect( function () |
15 | local mosPos = mouse.Hit |
I'm not an expert in terrain, although I hope to get better. Why do you declare origin, but never index it?
Try this
01 | local plugin = PluginManager():CreatePlugin() |
02 | local toolbar = plugin:CreateToolbar( "Hello World Plugin" ) |
03 | local terrain = Game.Workspace.Terrain |
04 |
05 | local smoothButton = toolbar:CreateButton( |
06 | "Smooth" , |
07 | "Use this to smooth an area of terrain" , |
08 | "SmoothIcon.png" |
09 | ) |
10 |
11 | smoothButton.Click:connect( function () |
12 | plugin:Activate( true ) |
13 | local mouse = plugin:GetMouse() |
14 | mouse.Button 1 Down:connect( function () |
15 | local mosPos = mouse.Hit |