This is the script i have made. "then" and "end" are red underlined and it wont work. ~~~~~~~~~~~~~~~~~
script.Parent.Num.Value = 4 then script.Parent.Sound:Play() end
This is the script i have made. "then" and "end" are red underlined and it wont work. ~~~~~~~~~~~~~~~~~
script.Parent.Num.Value = 4 then script.Parent.Sound:Play() end
#try
script.Parent.Num.Value.Changed:Connect(function(t)
if t == 4 then
script.Parent.Sound:Play()
end
end)
#or
script.Parent.Num:GetPropertyChangedSignal("Value"):Connect(function()
if script.Parent.Num.Value == 4 then
script.Parent.Sound:Play()
end
end)
if you still have errors, or you want to ask other things, simply dm me on discord #Blue Duck#8344
Multiple issues with your code;
Here is the fixed version:
if script.Parent.Num.Value == 4 then
script.Parent.Sound:Play()
end)
You'll need to check if it changes, then check if the change is 4.
script.Parent.Num.Value.Changed:Connect(function(newval)
if newval== 4 then
script.Parent.Sound:Play()
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
6 comments
Oh shoot! Thanks for the help!
Hmm i just tested it fully, no errors, but the audio isnt playing, any ideas?
Can you give me an idea of the structure? Like does the script take place in a model with Value inside of in and the audio inside of it?
aren't spaced out isn't a problem, it can still work without a new line.
true. it doesn't matter if its spaced out or not.
its not working cause you didn't set the audioid