So basically I want to make it so once you click on a button for a plugin, a UI appears on the screen(I cant figure out how to do this, ive looked at tutorials)
And also how do I tell where there mouse is? And then tell when they click? Basically just get there mouse.
local mouse = game:GetService("Players").LocalPlayer:GetMouse() -- gets the local player's mouse
print(mouse.X) -- mouse's x position on the screen
print(mouse.Y) -- mouse's y position on the screen
it’s easy to make a plugin, you’re gonna have to use PluginGuiService.
example code:
local PluginGuiService = game:GetService("PluginGuiService")
local button = script.Button -- change it to the button you need to trigger
local showUI = function()
local screenGui = PluginGuiService:CreateDockWidgetPluginGui("YOUR PLUGIN'S NAME ;)", DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Float,
true,
true,
300, -- initial width
200, -- initial height
200, -- minimum width
100 -- minimum height
))
local frame = Instance.new("Frame") -- example
frame.Parent = screenGui
end
button.MouseButton1Click:Connect(showUI)
20:57:54.130 user_Insert.rbxmx.Insert.Script:17: attempt to index nil with 'CreateDockWidgetPluginGui' - Edit - Script:17
20:57:54.130 Stack Begin - Studio
20:57:54.130 Script 'user_Insert.rbxmx.Insert.Script', Line 17 - Studio
20:57:54.130 Script 'user_Insert.rbxmx.Insert.Script', Line 35 - Studio
20:57:54.131 Stack End - Studio
Code:
-- get the toolbar
local toolbar = plugin:CreateToolbar('Insert')
local button = toolbar:CreateButton(
"Insert Onjects", -- text that appears below button
'Contains templates, objects, vehicles, etc! Then you can easily insert them!', -- Text that appears if you hover the mouse on button
"rbxassetid://13814749560" -- button Icon
)
local pgs = game:GetService('StarterGui'):FindFirstChild('PluginGuiService')
local showUI = function()
local screenGui = pgs:CreateDockWidgetPluginGui("YOUR PLUGIN'S NAME ;)", DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Float,
true,
true,
300, -- initial width
200, -- initial height
200, -- minimum width
100 -- minimum height
))
local frame = script.Parent:FindFirstChild('Frame'):Clone() -- example
frame.Parent = screenGui
end
button.Click:Connect(function()
showUI()
end)
local manager = game:GetService("PluginManager")
local plugin = manager:CreatePlugin()
local toolbar = plugin:CreateToolbar("plugin example")
plugin:Activate(true)