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

Can someone help me fix this script? I want to play a sound when a boolvalue is triggered.

I don't have much knowledge to scripting so I need a helping hand. Basically, I want a sound to play once a BoolValue is triggered. Here's an example (Note that the BoolValue works fine and it's named "Chasing" and the sound I want to play is located at game.Workspace.Monster6.HumanoidRootPart.footsteps2)

**script.Parent.Chasing.Changed:Connect(function() if script.Parent.Chasing.Value == true then

local sound = game.Workspace.Monster6.HumanoidRootPart.footsteps2)

sound:Play()

**

2 answers

Try this: script.Parent.Chasing.Changed:Connect(function() if script.Parent.Chasing.Value == true then

game.Workspace.Monster6.HumanoidRootPart.footsteps2:Play()

or

script.Parent.Chasing.Changed:Connect(function() if script.Parent.Chasing.Value == true then

workspace.Monster6.HumanoidRootPart.footsteps2:Play()

ok. Please use a code block next time you're including code in your question to make it readable.

Firstly, you create a variable to the path of the boolValue and of the sound:

local boolValue = --the path to the bool value
local sound = --the path to the sound you want to play



Next, you create an event to detect change in the boolValue's value:

local boolValue = --the path to the bool value
local sound = --the path to the sound you want to play

boolValue:GetPropertyChangedSignal("Value"):Connect(function()

if boolValue.Value then

sound.Value:Play()

end


end)

I dont know why ur code isn't working, maybe mine will. GL

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