I want to make a script to detect when the mouse button is held down, but it wont work. Here is my code
local UIS = game:GetService("UserInputService")
local holding = false
UIS.InputBegan:Connect(function(io)
if io.UserInputType == Enum.UserInputType.MouseButton1 then
holding = true
print("began")
end
end)
I’ve tried putting it in a local script inside of the playerscripts folder and a normal script inside a part in the work space.
I got it working after i took a closer look, apparently in needs to be in the “starterplayerscripts” folder. Putting it in “StarterPlayer” does not work