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)
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)