It’s saying nil in this case because it never found the sound and at this point music is nil.
Make sure your sound is where you’re saying and spelled exactly the same way and is a valid working sound. Also in this case use WaitForChild vs FindFirstChild.
In fact a FindFirstChild could have even set the load music in motion but, didn’t give it time to load by the point it hit music:Stop() … Who knows. Either way WaitForChild is the way to go here.
Green_Noob’s script works fine. It’s too simplistic to fail no matter how you call the child.
Something else is wrong here. Check that sound for name and volume.
Is this a massive track that takes longer to load than your test it time?
Can you play the sound at all? (even with a click from the studio)
Well, you’re messing with black holes and now you have broken the fabric of time.
I don’t know what else to say … the script works for me with a sound in the same spot.
Basically, the ship has music playing, and when you touch a part (basically you touch it with your foot) somewhere on the ship, the blackhole does something which turns the power off, but the part doesn’t turn the music off once walking over said part
Ok, I knew there was something else going on. Now let’s refine that script a bit so I don’t leave you with your next headake.
Well that was pretty fail, my bad. A slight adjustment. This will not only work out totally, it will only stop the sound for the player that touched it.
– LocalScript in StarterPlayerScripts or in StarterGui
task.wait(1)
local db=true
local part=workspace:WaitForChild("Part") -- where is this part!
local music=game.SoundService:WaitForChild("Music")
function partTouched(otherPart,objectPart)
if otherPart.Parent:FindFirstChild("Humanoid")~=nil then
if(db)then db=false
music:Stop() wait(40)
music:Play() db=true
end
end
end
part.Touched:Connect(partTouched)