SoundId not inserting the rbxasset://

Hello there!

I am currently having a bit of an issue trying to make the class Sound play once inserting the content, SoundId in my Script. I analyzed everything throughout the Output/Developer Console, but everything seems fine regarding the finding+ waiting for the child and adding properties into the object as their parent, except for the little line in the code down below:

findObject = workspace:WaitForChild("TheUnionObject")

if findObject then
	newParticle = Instance.new("ParticleEmitter", workspace)
	newParticle.Parent = workspace.TheUnionObject
	if newParticle.Parent then
		print("Something was added to the Union with a rope")
	elseif nil then
		print("Something is wrong!")
	end
	findtheParticleEmitter = game:FindFirstChild(workspace.TheUnionObject.ParticleEmitter)
	if findtheParticleEmitter then
		workspace.TheUnionObject.ParticleEmitter.Color = ColorSequence.new(Color3.fromRGB(255, 170, 255))
		workspace.TheUnionObject.ParticleEmitter.Texture = "http://www.roblox.com/asset/?id=2289899349"
	end
	for index = 1, 1 ,1 do
		print(index)
		break
	end
	newSound = Instance.new("Sound", workspace)
	newSound.Parent = workspace.TheUnionObject
	if newParticle.Parent then
		print("Roblox sound was added to the Union with a rope")
	elseif nil then
		print("The Roblox sound was not created. Try analyzing the script")
		findtheSound = game:FindFirstChild(workspace.TheUnionObject.Sound)
		if findtheSound then
			local UnionSound = workspace.TheUnionObject.Sound
			UnionSound.SoundId = "rbxassetid://6107075664"
			UnionSound.Volume = 0.75
			UnionSound:Play()
				wait(15)
			print("Roblox sound in the Union was set to be looped.")
			UnionSound.Looped = true
			UnionSound.RollOffMaxDistance = 30
		end
	end
end

If anyone can help me with the tiny issue, that would be very much appreciated!

Thank you! :smile:

1 Like

To note, the main issue is once finding creating a statement for findtheSound:

if findtheSound then
			local UnionSound = workspace.TheUnionObject.Sound
			UnionSound.SoundId = "rbxassetid://6107075664"
			UnionSound.Volume = 0.75
			UnionSound:Play()
				wait(15)
			print("Roblox sound in the Union was set to be looped.")
			UnionSound.Looped = true
			UnionSound.RollOffMaxDistance = 30
		end

What’s the issue with this part of the script? Is the sound not playing?

1 Like

It is actually once creating a value for the SoundId, “rbxassetid://6107075664”, and press to play, it does not insert the ID in the server + The others as you can see here:

findObject = game:WaitForChild(workspace.TheUnionObject)

This is incorrect use of WaitForChild.
https://developer.roblox.com/en-us/api-reference/function/Instance/WaitForChild
It expects a string value as its first argument.

I mean, I can simply re-phrase the first line, but I believe that is off-topic and not what I want to achieve…

findObject = workspace:WaitForChild("TheUnionObject")

I re-phrased the code of the topic, yet, I still want to figure out why the last part once giving a statement to findtheSound is not working, only the print area:

In the Output/Developer Console, everything is fine, however, the property “Sound” is not playing, the volume did not change the value, etc.

why ru doing game:FindFirstChild(workspace.TheUnionObject.Sound)
you can just do

game.Worspace:FindfirstChild("TheUnionObject").Sound