I wanna use MouseButton1Down so how do i do it?
This is what i've tried in a LocalScript but it didn't work:
local Mouse = game.Players.LocalPlayer:GetMouse() Mouse.MouseButton1Down:connect(function(Key) script.Parent:CaptureFocus() end)
Ok, so there answer above has no problem in it just that he didn't add the :Capture Focus Function
in there.... So just do this following code inside of a Local Script
under the TextBox
...
local player = game.Players.LocalPlayer local mouse = player:GetMouse() mouse.KeyDown:connect(function() script.Parent:CaptureFocus() end
MouseButton1Down
is an event of GUIs. This means you can only use it on TextButtons and ImageButtons (with the event firing when the gui is clicked).
mouse
has a separate event, which is just Button1Down
. You can use that.
local mouse = game.Players.LocalPlayer:GetMouse() mouse.Button1Down:connect(function() print("clicked") end)
Ok I got it to work, you never told me the localscript had to be in StarterGui LOL :D
--Adornee is set to "Test" a part in game.Workspace local mouse = game.Players.LocalPlayer:GetMouse() mouse.Button1Down:connect(function() if mouse.Target == "Test" then script.Parent:CaptureFocus() end end)