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

What Is Wrong With This Sword Shop Gui?

Asked by
jacobwow 140
10 years ago

When I click to buy the speed coil it doesn't give it to me. Whats wrong?

player = script.Parent.Parent.Parent.Parent.Parent -- your backpack
Points = player.leaderstats.Knockouts -- type of currency used (EX: Money, Cash, Gold, Points)
upgradeStuff = script.Parent.SpeedCoil -- The name of the tool, put it in this button's parent

function buy()
if Points.Value >= 8 then -- Change the 100 to the price you want

    Points.Value = Points.Value - 0 --  same as above

        upgradeStuff:clone().Parent = player.Backpack -- puts the item into the backpack

    wait(2)
else -- if you don't have enough money
        script.Parent.Text = "Not Enough Funds" 
    wait(3)
        script.Parent.Text = "Speed Coil"  -- change WeaponName to your button's text
end
end

script.Parent.MouseButton1Down:connect(buy)

2 answers

Log in to vote
0
Answered by
Rukiryo 25
10 years ago

Honestly you shouldn't store the tool in workspace. It should be stored inside ReplicatedStorage and cloned from there. Please give us output logs if this doesn't fix it. Your setup is questionable so we can't tell you what's wrong.

Ad
Log in to vote
0
Answered by 10 years ago

Like Rukiryo said, storing swords into the workspace is not a good idea. People can then grab the swords if they can get to them. So put them in ReplicatedStorage for it to be cloned when people buy it.

Answer this question