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

why wont my sound play when i touch a part?

local enabled = false
script.Parent.Touched:Connect(function(hit)
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	if not player then return end
	if not enabled then
		enabled = true
		wait(1)
		local sound = player.Backpack.wild_freedom
		sound:Play()
		enabled = false
		print("done")
	end
end)

prints done but no sound plays this is updated code

2 answers

✓ Accepted answer

Playing is a boolean property used to understand if the Sound is currently playing or not. It does not actually enable the Sound Object. Use the :Play() method of Sound to properly begin the soundtrack.

Sound Objects can only be heard within physical environments too, therefore, a Sound must be in workspace to fully operate. If you wish for the Sound to play locally to a Part, then simply store the Object within the Instance.

5 comments

0

yea i tried to use :Play() but that did nothing

0

I made a late edit, please read again.

0

as you can see, the sound doesnt play https://imgur.com/a/TaCAj4M¨

0

ok im gonna try with changing to workspace

0

worked

Backpack can't store values such like sounds, game stats, part properties and etc. Please put it on workspace and do this line:

local sound =  workspace.wild_freedom

2 comments

0

oo wait the up post have marked as correct so uh i don't wanna delete, let me just put it here

0

yeah, i only put the sound in the wrong service and feahren was quicker to explain that was the issue

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