local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local sound = script.Parent.Sound
local holding = false
Mouse.Button1Down:Connect(function()
holding = true
end)
Mouse.Button1Up:Connect(function()
holding = false
end)
while true do
if holding == true then
sound:Play()
task.wait(sound.TimeLength)
else
break
end
end
local UserInputService = game:GetService("UserInputService")
local sound = script.Parent.Sound
local holding = false
UserInputService.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
holding = true
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
holding = false
end
end)
while holding do
sound:Play()
task.wait(sound.TimeLength)
end
local UserInputService = game:GetService("UserInputService")
local sound = script.Parent.Sound
local holding = false
UserInputService.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
holding = true
while holding do
sound:Play()
task.wait(sound.TimeLength)
if not holding then break end
end
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
holding = false
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
holding = false
sound:Stop()
end
end)
local button = path.Button
local sound = script.Parent.Sound
local holding = false
button.MouseButton1Click:Connect(function()
holding = true
while holding do
sound:Play()
task.wait(sound.TimeLength)
if not holding then break end
end
end)
button.MouseButton1Up:Connect(function()
holding = false
sound:Stop()
end)