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

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

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)

1 comment

0

Sorry if I made the Codes kinda mixed lol, once it shows "1" it's the next Script.

1 answer

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.

2 comments

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

0

You removed the TouchEnded event?

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