this is a script for my plugin that im trying to create where you can quickly select text on a part, every time i click, it prints not enabled
(it should print that since i didnt enable the plugin via the button) but when i press the button it refuses to print anything when mouse.Button1Down fires, i dont even think mouse.Button1Down fires at all, im super confused and i couldnt find any solutions, could anybody help???
local toolbar = plugin:CreateToolbar("Text quick select")
local button = toolbar:CreateButton("Enable", "Click to enable the plugin.", "rbxassetid://17524898236")
local selectionservice = game:GetService("Selection")
plugin:Activate(true)
local mouse = plugin:GetMouse()
local enabled = false
button.Click:Connect(function()
enabled = not enabled
plugin:SelectRibbonTool(Enum.RibbonTool.None, UDim2.new(0,0,0,0))
end)
local function toggleGui()
print("toggling GUI")
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Parent = game.CoreGui
local Frame = Instance.new("Frame")
Frame.BackgroundColor3 = Color3.fromRGB(71, 71, 71)
Frame.BackgroundTransparency = 0.300
Frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
Frame.BorderSizePixel = 0
Frame.Position = UDim2.new(0.427325577, 0, 0.479032248, 0)
Frame.Size = UDim2.new(0, 200, 0, 25)
Frame.Parent = ScreenGui
local TextBox = Instance.new("TextBox")
TextBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TextBox.BackgroundTransparency = 1.000
TextBox.BorderColor3 = Color3.fromRGB(0, 0, 0)
TextBox.BorderSizePixel = 0
TextBox.Size = UDim2.new(0, 200, 0, 25)
TextBox.Font = Enum.Font.SourceSans
TextBox.Text = ""
TextBox.TextColor3 = Color3.fromRGB(0, 0, 0)
TextBox.TextSize = 14.000
TextBox.Parent = Frame
local TextButton = Instance.new("TextButton")
TextButton.BackgroundColor3 = Color3.fromRGB(89, 255, 43)
TextButton.BorderColor3 = Color3.fromRGB(0, 0, 0)
TextButton.BorderSizePixel = 0
TextButton.Position = UDim2.new(1, 0, 0, 0)
TextButton.Size = UDim2.new(0, 25, 0, 25)
TextButton.Font = Enum.Font.SourceSans
TextButton.Text = "✓"
TextButton.TextColor3 = Color3.fromRGB(0, 0, 0)
TextButton.TextSize = 14.000
TextButton.Parent = Frame
TextButton.MouseButton1Click:Connect(function()
ScreenGui:Destroy()
return TextBox.Text
end)
end
local function findchildren(parent)
print("finding children")
for _,child in pairs(parent:GetChildren()) do
if child:IsA("GuiObject") then
if child:IsA("TextLabel") or child:IsA("TextButton") then
child.Text = toggleGui() -- Change this line as needed
elseif child:IsA("TextBox") then
child.PlaceholderText = toggleGui() -- Change this line as needed
end
end
if child:IsA("SurfaceGui") or child:IsA("Frame") then
findchildren(child)
end
end
end
mouse.Button1Down:Connect(function()
print("click")
if enabled then
print("enabled")
local target = mouse.Target
if target then
findchildren(target)
print(not not not not true)
else
print("no target")
end
else
print("not enabled")
end
end)