01 | local UIS = game:GetService( "UserInputService" ) |
02 | local runService = game:GetService( "RunService" ) |
03 | --local |
04 | local player = game.Players.LocalPlayer |
05 | local slider = script.Parent |
06 | local sliderbar = script.Parent.Parent |
07 | local Bckcolor = script.Parent.Parent.Color |
08 | local held = false |
09 | UIS.InputBegan:Connect( function (Input, Processed) |
10 | if Input.UserInputType = = Enum.UserInputType.MouseButton 1 then |
11 | held = true |
12 | end |
13 | end ) |
14 | UIS.InputEnded:Connect( function (Input, Processed) |
15 | held = false |
Do a while true do when the held is true
For example
1 | while held = true do |
2 | --function here |
3 | end |
There is a RBXScriptSignal called Button2Down that comes with the mouse
1 | game.Players.LocalPlayer:GetMouse().Button 2 Down:Connect( function () |
2 | print ( "Player is holding down right click" ) |
3 | end ) |
https://developer.roblox.com/en-us/api-reference/event/Mouse/Button2Down
01 | local UIS = game:GetService( "UserInputService" ) |
02 | local runService = game:GetService( "RunService" ) |
03 | local SN = script.Parent.Parent.Parent.Parent.SoundNumber.Number |
04 | local player = game.Players.LocalPlayer |
05 | local slider = script.Parent |
06 | local sliderbar = script.Parent.Parent |
07 | local Bckcolor = script.Parent.Parent.Color |
08 | local part = script.Parent.Parent.Parent.range |
09 | local held = false |
10 | UIS.InputBegan:Connect( function (Input, Processed) |
11 | if Input.UserInputType = = Enum.UserInputType.MouseButton 1 then |
12 | part.MouseEnter:Connect( function () |
13 | slider.MouseButton 1 Down:Connect( function () |
14 | held = true |
15 | end ) |