So, I have a TextButton taht is created trough a script, and a script taht is patented under the button, but when I try doing:
button.MouseButton1Down
It trows an error for some reason, if you need the full script just ask
So, I have a TextButton taht is created trough a script, and a script taht is patented under the button, but when I try doing:
button.MouseButton1Down
It trows an error for some reason, if you need the full script just ask
You should always support the whole script, so please, send it
Okay:
Script that creates the button (thereâs some variables taht are to create the plugin, I donât think you need them):
local weldButton = Instance.new(âTextButtonâ);
weldButton.Text = âCreate Weldâ;
weldButton.Size = UDim2.new(1,0,1,0);
weldButton.Visible = true
weldButton.Parent = widget
local weldScript = game:GetService(âServerScriptServuce).WeldPlugin.WeldScript
weldScript.Parent = weldButton
Thatâs what creates the button and reparents the weldScript
The script taht errors:
local selection = game:GetService(âSelectionâ)
local function onClick()
local selected = selection:Get();
if #selected == 1 then
print(âSelected one objectâ)
else
warn(âSelect only one main part!â)
end
end
button.MouseButton1Down:Connect(onClick) --here it errors
Error:
âMouseButton1Down is not a valid member of Folder âuser_WeldPlugin.rbxmx.WeldPluginâ
I am not solid with how Plugins work but this shows that you are trying to Click a folder?
button.MouseButton1Down:Connect(onClick) --here it errors
to
weldButton.MouseButton1Down:Connect(onClick)
-- Make sure to define weldButton if this all isnt in one script
This is on a LocalScript that is parented under the weldButton, meaning taht script.Parent is the button
Iâm sure taht itâs changing parent as I see that it disappears from the folder in which itâs in by default
script.Parent.MouseButton1Down:Connect(onClick)
That doesnt work?? Let me find a doc for you then
Iâll try that ASAP
Still trows the same error
Apparently this is how you create a new button
-- Add a toolbar button named "Create Empty Script"
local newScriptButton = toolbar:CreateButton("Create Empty Script", "Create an empty script", "rbxassetid://4458901886")
The button needs to be a TextButton, the one in the toolbar already existss
Yeah then just try what I sent, sorry about that
Welp Dede heres your solution:
button.InputBegan:Connect(function(i)
if i.UserInputType == Enum.UserInputType.MouseButton1 then
-- do sum goofy ah stuff
end
end)
yes it was tested
Itâs not working for some reason, I used your code but itâs not working, itâs still printing the same error but with InputBegan
, Iâm trying to create it from script now and Iâll tell you do it works
Edit: still doesnât work
ok so have you activated the mouse?
type plugin:Activate(true)
in the main plugin script and use
plugin.Deactivated:Connect(function()
plugin:Activate(true)
end)
if you want it to like always be active (the top code piece is optional)
The error is literal, youâre trying to use the connection on a folder, are you sure youâre referencing the correct textbutton?
Creating the UI from start and using it as the code goes on is sometimes a better idea, I donât know if you managed to stop more-than-one buttons being created.
Yes Iâm sure, the WeldScript
when I try to edit it while itâs patented to the button gives me MouseButton1Down
and only-buttons options
@SomeFedoraGuy how would I put the GUI in the widget?
Are you using Roblox Studioâs widgets or creating your own UI?
Iâm using Studioâs ones