of     1   

wolfbane3333
#184117379Monday, February 22, 2016 1:57 AM GMT

This is supposed to play music while the mouse is pressed down but I don't really know how to handle that. Here's the code: debounce = false music = script.Parent.keyboard function onMouseDown(mouse) music:Play() debounce = true end function onMouseUp(mouse) music:Stop() debounce = false end function onClicked(mouse) print("all dandy") if debounce == false then print("all good") mouse.Button1Down:connect(function() onMouseDown(mouse) end) elseif debounce == true then print("all swell") mouse.Button1Up:connect(function() onMouseUp(mouse) end) end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
wolfbane3333
#184120440Monday, February 22, 2016 2:40 AM GMT

Bump.
Antheer
#184122317Monday, February 22, 2016 3:08 AM GMT

It would not be mouse.Button1Up it would be MouseButton1Up or MouseButton1Down
Antheer
#184122358Monday, February 22, 2016 3:09 AM GMT

And also, you would have to do a remoteevent to play music, you cannot play music manually in game.
xXTrGamerZinXx
#184124821Monday, February 22, 2016 3:43 AM GMT

debounce = false music = script.Parent.keyboard function onMouseDown(mouse) music:Play() debounce = true end function onMouseUp(mouse) music:Stop() debounce = false end function onClicked(mouse) print("all dandy") if debounce == false then print("all good") mouse.Button1Down:connect(function() onMouseDown(mouse) end) elseif debounce == true then print("all swell") mouse.Button1Up:connect(function() onMouseUp(mouse) end) end end script.Parent.ClickDetector.MouseClick:connect(onMouseDown) --------Here
wolfbane3333
#184130822Monday, February 22, 2016 5:42 AM GMT

Errors: 22:41:35.506 - MouseButton1Down is not a valid member of Player 22:41:35.506 - Script 'Workspace.Wedge.Script', Line 20 22:41:35.507 - Stack End
wolfbane3333
#184130918Monday, February 22, 2016 5:44 AM GMT

@xXTrGamerZinXx That does make the music play but does not make it stop when the mouse is up
128Gigabytes
#184132131Monday, February 22, 2016 6:20 AM GMT

local sound = game.Workspace.Sound game:getService("UserInputService").inputBegan:connect(function(input, _) if (input.UserInputType == Enum.UserInputType.MouseButton1) then sound:play() end end) game:getService("UserInputService").inputEnded:connect(function(input, _) if (input.UserInputType == Enum.UserInputType.MouseButton1) then sound:stop() end end) credit to cnt for making me less stupid
wolfbane3333
#184174563Tuesday, February 23, 2016 2:09 AM GMT

That worked splendidly, Thank you
wolfbane3333
#184175253Tuesday, February 23, 2016 2:19 AM GMT

Would it also be possible to have it so it only works for one person at a time?
128Gigabytes
#184184025Tuesday, February 23, 2016 5:12 AM GMT

Check if the sound is playing already before playing it.

    of     1