Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make my sound Script stop disconnecting when I jump??

Asked by 5 years ago

Hello, beginner scripter here.. So I'm not that amazing at scripting obviously, so I need someone that is better to help me with this. I have a Script that uses a Brick (Brick keeps the sound in the area so it doesn't escape outside of it) In the Starter GUI I have 2 Sounds. One for Stop & One for Play. But I noticed whenever I jump the sound completely vanishes and I feel like the issue is could be that I made it a "Touch" script..? Hoping someone can help me!! I will post the 2 scripts inside of the block.

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid')then 
game.Players[hit.Parent.Name].PlayerGui.Sound2:Stop()
game.Players[hit.Parent.Name].PlayerGui.Sound1.Volume=1
game.Players[hit.Parent.Name].PlayerGui.Sound1:Play()   

end 
end)


script.Parent.TouchEnded:connect(function(hit)
 if hit.Parent:FindFirstChild('Humanoid')then
 game.Players[hit.Parent.Name].PlayerGui.Sound1.Volume=0
 end
end)
0
Sorry if I made the Codes kinda mixed lol, once it shows "1" it's the next Script. 2Westy2 2 — 5y

1 answer

Log in to vote
0
Answered by
T1mes 230 Moderation Voter
5 years ago

The reason it's stopping when you jump is because of your second script

script.Parent.TouchEnded:connect(function(hit) -- Fires when something stops touching the part
 if hit.Parent:FindFirstChild('Humanoid')then
 game.Players[hit.Parent.Name].PlayerGui.Sound1.Volume=0 -- Turns sound1 off
 end
end)

When you are jumping it's turning Sound1's volume to 0, essentially turning it off.

p.s. you can have both of those scripts in one script.

0
Yeah I've been messing with the script and took the Stop part out and everything and it still stops when I jump. So I'm clueless on that. Basically just stops no matter what once I jump 2Westy2 2 — 5y
0
You removed the TouchEnded event? T1mes 230 — 5y
Ad

Answer this question