varjoy
(variable)
February 11, 2021, 4:42pm
#1
Hello, I am having troubles with audios… not playing
Code:
if (RealDanger and Variables.Speed > 10 and (not Variables.Keys.S)) then
if not (alert.Playing) then
alert:Play()
print("alert!")
end
end
Variable=
local brake,alert = Configurations.DistanceDetection.beeplarger,Configurations.DistanceDetection.beep
print(brake,alert) -- prints correctly their name..
Video of error;
This is a local script.
1 Like
varjoy
(variable)
February 11, 2021, 4:43pm
#2
All audios are approved, and when testing in studio and doing play, it works, but not with command bar on scripting
Here’s command bar;
Da_Fr0st
(Frost)
February 11, 2021, 4:51pm
#3
Have you specified in the script what the audio you are playing is?
varjoy
(variable)
February 11, 2021, 4:52pm
#4
Yes, in the variables, it’s a sound in a part.
Da_Fr0st
(Frost)
February 11, 2021, 4:55pm
#5
Did you do the full path when doing variables? eg.
local alert = game.testcar.Detection.beep
local Lalert = game.testcar.Detection.beeplarger
varjoy
(variable)
February 11, 2021, 4:56pm
#6
yes… I just showed the variables here
varjoy:
Variable=
local brake,alert = Configurations.DistanceDetection.beeplarger,Configurations.DistanceDetection.beep
print(brake,alert) -- prints correctly their name..
Da_Fr0st
(Frost)
February 11, 2021, 4:57pm
#7
is the script inside the car model?
varjoy
(variable)
February 11, 2021, 4:58pm
#8
no, in player UI, but it’s not the trouble, I got the audios, they’re just not playing.
Da_Fr0st
(Frost)
February 11, 2021, 5:01pm
#9
ok.
surely that not right because in the path sould end with
Detection.beep
not
varjoy:
DistanceDetection.beep
Also here is the api documentation for SoundService:PlayLocalSound
Da_Fr0st
(Frost)
February 11, 2021, 5:04pm
#11
do you have a game link where I can test the sound?
varjoy
(variable)
February 11, 2021, 5:06pm
#12
This seems like it worked
How can I stop audio without creating another?
nicdalord
(NICOLASSOCAFORTE)
February 11, 2021, 5:07pm
#13
you must show us the whole script if you dont do that we can’t help you, i got what you’re trying to do but I dont know how to help you when you just write a part from the scritpt
nicdalord
(NICOLASSOCAFORTE)
February 11, 2021, 5:08pm
#14
local audio = Detection.beep
audio:Stop()
Da_Fr0st
(Frost)
February 11, 2021, 5:10pm
#15
local audio = Detection.alert
audio:Stop()
varjoy
(variable)
February 11, 2021, 5:10pm
#16
Can someone experienced help me? this seems like none helped me yet…
The code is right, I am using :Play() but it won’t play.
Da_Fr0st
(Frost)
February 11, 2021, 5:11pm
#17
I thought it worked. So does it or does it not work?
varjoy:
but it won’t play.
varjoy
(variable)
February 11, 2021, 5:12pm
#18
It’s not what I’m searching for, I just want to understand why Sound:Play() inside a part is not working on a local script.
I think its because Sound:Play() is used only in server. Not sure though, but PlayLocalSound is used for local scripts, not server replication