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

[SOLVED] Sound doesn't play when I want it to play, how do I fix it?

So, I wanted to make a tycoon. Everything works perfectly so far, however when I got to the cosmetic parts a problem arised. When I'm trying to tell the game to play a sound it won't. I'll post a script fragment and hopefully you'll be able to help me resovle the issue.

local DB = false
v.Button.Touched:Connect(function(Hit)
	if Valid(Hit) then
		if DB == false then
			DB = true
			if v.Button.Transparency == 0 then
				local Bought = Buy(Hit,v,v.Price.Value,Objects[v.Object.Value])
				if Bought then
					warn ("Purchased")
					game.ServerStorage.ItemPurchased:Play(Hit)
				else
					warn ("Stalled")
					game.ServerStorage.ItemStalled:Play()
					v.Button.BrickColor = BrickColor.new("Dusty Rose")
					wait(0.5)
					v.Button.BrickColor = BrickColor.new("Shamrock")
					wait(0.5)
				end
			end
			DB = false
		end
	end
end)

2 comments

0

Play() has no parameter. It plays the sound it was called from.

0

No, I already tried removing it. It doesn't help.

1 answer

    local DB = false
v.Button.Touched:Connect(function(Hit)
	if Valid(Hit) then
		if DB == false then
			DB = true
			if v.Button.Transparency == 0 then
				local Bought = Buy(Hit,v,v.Price.Value,Objects[v.Object.Value])
				if Bought then
					warn ("Purchased")
					game.ServerStorage.ItemPurchased:Play()
				else
					warn ("Stalled")
					game.ServerStorage.ItemStalled:Play()
					v.Button.BrickColor = BrickColor.new("Dusty Rose")
					wait(0.5)
					v.Button.BrickColor = BrickColor.new("Shamrock")
					wait(0.5)
				end
			end
			DB = false
		end
	end
end)

4 comments

0

The problem was that you added Hit to the parameter, to what I remember, I don't think there is a parameter for :

0

:Play()

0

:Play()

0

No, I already tried removing it. It doesn't help.

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