Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 5 years ago
Edited 5 years ago

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)

0
Play() has no parameter. It plays the sound it was called from. DeceptiveCaster 3761 — 5y
0
No, I already tried removing it. It doesn't help. dawidu156 5 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
    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)
0
The problem was that you added Hit to the parameter, to what I remember, I don't think there is a parameter for : SuperSamyGamer 316 — 5y
0
:Play() SuperSamyGamer 316 — 5y
0
:Play() SuperSamyGamer 316 — 5y
0
No, I already tried removing it. It doesn't help. dawidu156 5 — 5y
Ad

Answer this question