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

Click to place model plugin?

Asked by
Miztix 0
9 years ago

Hello, I would like to know if anyone of you have any suggestions on making this. I want a model to be placed when you click anywhere, this is what I have so far:

print("Loading Plugin...")

-- Check if user has loaded plugin before
local hasLoaded = plugin:GetSetting("pluginHasLoaded")
if not hasLoaded then
    print(" To use this plugin, click on the button in the addon bar, then click on the object you want to inspect.")
    plugin:SetSetting("pluginHasLoaded", true)
end

-- Setup Toolbar
local toolbar = plugin:CreateToolbar("Plugin")

-- Setup button
local button = toolbar:CreateButton(
    "Tree Generator",
    "Generates Trees",
    "http://www.roblox.com/asset/?id=253840185"
)
button.Click:connect(function()
    print("Plugin is now active")
    plugin:Activate(true) -- Neccessary to listen to mouse input
end)

-- Setup mouse
local mouse = plugin:GetMouse()
mouse.Button1Down:connect(function() -- Binds function to left click
    local target = mouse.Target
    if target then
        print("Target: " .. target.Name)
    end
    print("X: " .. mouse.X .. " Y: " .. mouse.Y)
end)

print("Finished Loading ")

Answer this question