realknife
(realknife)
November 22, 2020, 1:54pm
#1
I was creating a game, and i have certain sound play when certain event occurs (unrelated)
And i want that sound to stop before it ends by itself, so i wrote a script for that, based on what i was able to understand:
script.Parent.TimePosition = 0
wait(4)
script.Parent.Sound:Stop()
But it doesen’t work, i would be more than grateful, if someone can tell me what i’m doing wrong.
1 Like
elvinfcb9
(ElvinYaeger)
November 22, 2020, 1:59pm
#2
Script.Parent.Sound:Pause() You could try that as well
3 Likes
httpDerpyy
(httpDerpyy)
November 22, 2020, 2:39pm
#3
From what I’ve understood, the sound Instance is script.Parent, correct?
Simply do
script.Parent:Stop()
You don’t need to use a .Sound on a Sound Instance because it already knows you’re referring to what its playing.
1 Like
low0ps
(low0ps)
November 22, 2020, 2:40pm
#4
Is there any errors in your output? You’re referencing what appears to be a sound twice, and each of them have different paths, is that intended?
1 Like
ede2355
(ede2355)
November 22, 2020, 2:45pm
#5
You’re essentially referencing another sound object which most probably doesn’t exist. Your code should look like this:
script.Parent.TimePosition = 0
wait(4)
script.Parent:Stop()
1 Like
iccletus
(ccletus)
November 22, 2020, 2:48pm
#6
sound:Stop()
print("stop", sound.Playing, sound.TimePosition) -- stop false 0
wait(3)
try this!
1 Like
realknife
(realknife)
November 22, 2020, 5:29pm
#7
Turns out, since some objects weren’t created by me, i had to make small modifications to the block of code that came with the object i was giving sound to.
1 Like