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

Buy not working?

Asked by
wackem 50
8 years ago

I'm adding buyable characters, but this script doesn't work and I don't know what's wrong, keep in mind it is NOT a local script

-- Note: 1 = true, 0 = false

local t = script.Parent.Parent.Label
local p = t.Parent.Parent.Parent.Parent.Parent.Parent
local b = script.Parent
local st = p:WaitForChild("AnimsChar").OwnsIntellect
local coins = p:WaitForChild("leaderstats").Coins
local cost = 250

b.MouseButton1Click:connect(function()
    if coins.Value >= cost then
    if st.Value == 0 then
        st.Value = 1
        coins.Value = coins.Value - cost
        print('k')
    end
    end
end)

Answer this question