Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make It so that when I click anything it plays a sound when I stop it doesn't?

Asked by 2 years ago

Hi guys, So uh can anyone help me with this script: Sound = Instance.new("Sound") Sound.Parent = game.workspace Sound = "9815509707" function onclick(mouse) Sound:Play() end

0
Also forgot to mention i want it to only be client Pro_beatz 36 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

made you a script that works

local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()

--functions

local function playsound()
    --plays the sound
    sound = Instance.new("Sound")
    sound.Parent = player.Character
    sound.SoundId = "rbxassetid://9815509707"
    sound:Play()

end 

local function stopsound()
        --stops the sound
        sound:Stop()
        sound:Destroy()
    end
--input for playing the sound
mouse.Button1Down:Connect(playsound)
--input for stopping the sound
mouse.Button1Up:Connect(stopsound)
0
Thanks, bro i suck at scripting Pro_beatz 36 — 2y
0
make sure to put it in starter player scripts Not_prototype 50 — 2y
Ad

Answer this question