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

How to make an audio play when tool is activated, but stop once I click again?

Tool = script.Parent
function onActivated()
	Tool.Bape.Stark:Play()
	wait(0.1)
	Tool.Bape.Stark:Stop()
end

I know it's not much to work with, but I'm kinda at a loss right now. Sorry in advance.

1 answer

You're almost there!

To detect when a player does a Left-Click with tools, we can "listen" for it with the tool.Activated event! This event fires every time a player Left-Clicks with the tool equipped.

In your code, this would be...

Tool.Activated

Also just a little extra, I like to construct my listening events like this, but you can keep it your way.

Tool.Activated:Connect(function()
	-- Stuff Here!
end)

Either way is fine, this is just my preferred way. You can try it out for yourself too!

Any problems? Just comment below!

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