Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

1 comment

0

Also forgot to mention i want it to only be client

1 answer

✓ Accepted answer

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)

2 comments

0

Thanks, bro i suck at scripting

0

make sure to put it in starter player scripts

This discussion is preserved as it was. New answers, comments, and votes are closed.