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) |