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

Can someone help me with this script?

Asked by 8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I made a script but.. Locked and Unlocked works but it won't buy the gear i hope someone can help me Thanks

wait(5)
player = script.Parent.Parent.Parent.Parent.Parent.Parent
money = player.leaderstats.Level
price = 4 --Needed Level
tool = game.Lighting:findFirstChild("BlueStep")

function buy()
if money.Value >= price then
money.Value = money.Value - price
money.Value = money.Value + 4 --Keep the level
local a = tool:clone()
a.Parent = player.Backpack
local b = tool:clone()
b.Parent = player.StarterGear

end
end

while true do
    wait(2)
if money.Value >= 4 then --Up 4
    script.Parent.Text = "Unlocked"
else
    if money.Value <= 4 then --Under 4
        script.Parent.Text = "Locked"   
    end
end
end
script.Parent.MouseButton1Down:connect(buy)
1
Because the while loop is preventing the script from reaching the connection line, move line 29 above the while true do loop. Or change the while true do loop to a Changed event for every time the 'money' value changes. M39a9am3R 3210 — 8y

Answer this question