Sound Played when gear is equipped

What I want to achieve is when I pull out a weapon and I click it has a sound only for that weapon.

The issue im having is if I click on the screen it makes the sound even is the weapon is out.

I watched a couple videos and still couldn’t fix it.

Here is the Current script I have and Ill attach a video to show the issue

local sound = script.Parent.Beep
local UIS = game:GetService(“UserInputService”)

UIS.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
sound:play()
end
end)


I think you forgot to stop it

It’s detecting the MouseButton1, not equipping. Try using tool.Equipped
Also, for detecting clicks, I suggestion using Tool.Activated, it looks much cleaner and shorter and has the same function

Your script actually mean, when you click on your mouse it play the sound no matter if there is a weapon equiped.

  • Move the sound in the “Handle” part of your weapon tool
  • Add a script on the weapon tool
local Tool = script.Parent

Tool.Activated:Connect(function()
	local Handle = Tool:WaitForChild("Handle" ,5)

	if Handle ~= nil then
		local Sound = Handle:WaitForChild("Beep" ,5)

		if Sound ~= nil then
			Sound:Play()
		end
	end
end)

Capture

4 Likes