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

I need help fixing my script that plays a sound when I click with the tool. Can someone help please?

So basically, I have this code that gives me a stick, but I want to make it play a sound when i click with it. The problem is, the current one I am using doesn't work!

The full script is here.

Stick.Activated = false

Instance.new("Part",workspace)
game.Workspace.Part.Name = "Handle"
game.Workspace.Handle.BrickColor = BrickColor.New('CGA brown')
game.Workspace.Handle.Size = Vector3.new(1.06, 4.75, 0.91)
game.Workspace.Handle.Anchored = false
wait()
Instance.new("Tool",workspace)
game.Workspace.Tool.Parent = game.Players.Paladior.Backpack
game.Workspace.Handle.Parent = game.Players.Paladior.Backpack.Tool
game.Players.Paladior.Backpack.Tool.Name = "Stick"
game.Players.Paladior.Backpack.Stick.ToolTip = "hehe stick go b o n k"
game.Players.Paladior.Backpack.Stick.GripPos = Vector3.new(0, -2, 0.2)



tool= game.Players.Paladior.Backpack.Stick
player=game.Players.LocalPlayer
tool.Activated:connect(function()
 tool.GripForward = Vector3.new(0,10,-1)
clicked = true
wait(0.5)
tool.GripForward = Vector3.new(0,0,1)
clicked = false
end)


--tons and tons of SPECIAL EFFECTS
if
Stick.Activated == true
then
Instance.new("Sound",Workspace)
Sound.SoundId = '130944130'
Sound.name = 'bonk'
game.Workspace.bonk.Parent = SoundService
game.SoundService.bonk:Play()

If you don't want to read all of that, the part that isn't working is here.

--tons and tons of SPECIAL EFFECTS
if
Stick.Activated == true
then
Instance.new("Sound",Workspace)
Sound.SoundId = '130944130'
Sound.name = 'bonk'
game.Workspace.bonk.Parent = SoundService
game.SoundService.bonk:Play()

I'm using a value at the top of the script, but that's not working either. Any help is appreciated!

5 comments

0

I'M A CLOWN. I accidentally pasted the same script twice in the first one, I will try to fix it lol

0

i think i fixed it

0

I'm posting this as a comment as I am not sure... But have you made a chunk of sceipt

0

Script that makes it activate when clicked?

0

Why not use a "if humanoid if the object touching stick, play sound" if statement?

1 answer

Make sure it has rbxassetid:// before it. So it would be:

Sound.SoundId = 'rbxassetid://130944130'

2 comments

0

Also I think you need to lowercase the Workspace to workspace

0

Nah, Workspace is a service which means it isn't caps sensitive.

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