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

Is There A Bug In My Shop Gui?

Asked by
jacobwow 140
10 years ago

My store gui does not work when I click to buy the item. Here is the script:

player = script.Parent.Parent.Parent.Parent.Parent
kills = player.leaderstats.Knockouts
Item = game.ReplicatedStorage.SpeedCoil

function buy()
if kills.Value >= 8 then

    kills.Value = kills.Value - 0

        Item:clone().Parent = player.Backpack

    wait(2)
else
        script.Parent.Text = "Not Enough Funds" 
    wait(3)
        script.Parent.Text = "Speed Coil"
end
end

script.Parent.MouseButton1Down:connect(buy)
0
Do you have a output? M39a9am3R 3210 — 10y
0
No jacobwow 140 — 10y
0
Wait, see the problem. It's MouseButton1Click, MouseButton1Down means you must hold the button down for a prolonged period of time before it may activate. M39a9am3R 3210 — 10y

2 answers

Log in to vote
0
Answered by
Tesouro 407 Moderation Voter
10 years ago

Possible diagnostics:

  • not in a LocalScript
  • Active property of the Gui object is false
  • Gui object is not a button
0
Try to check these, maybe it work then. Tesouro 407 — 10y
0
1) I do not think it will matter much. 2) I have a button at my place that is active, and it works. 3) I went to his place and it is a button. M39a9am3R 3210 — 10y
Ad
Log in to vote
0
Answered by
jacobwow 140
10 years ago

I tried to make a different one an had no luck, no errors or even outputs were given. Whats wrong here?

Cash = script.Parent.Parent.Parent.Parent.Parent.leaderstats.KOs

function onClick()
    if Cash.Value >= 8 then
        Cash.Value = Cash.Value - 0
            local item = game.ServerStorage.SpeedCoil:clone()
            item.Parent = script.Parent.Parent.Parent.Parent.Parent.StarterGear
            item.Parent = script.Parent.Parent.Parent.Parent.Parent.Backpack
            print("Yay")
    else
        script.Parent.Text = 'Nope'
        wait(3)
        script.Parent.Text = 'Speed Coil'
        print("Yay?")
    end
end

script.Parent.MouseButton1Click:connect(onClick)

Answer this question