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

Why is my value not changing?

Asked by 8 years ago

All heirarchy is correct, There are NO errors in the output.

Please Help D:

Player = game.Players.LocalPlayer
leaderstats = Player:WaitForChild('leaderstats')
gold = leaderstats:WaitForChild('Sticks')
Item2 = leaderstats:WaitForChild('Wood')
Product = leaderstats:WaitForChild('WoodenAxe')
craftbar = script.Parent.Parent.Parent.Parent.CraftBar.BarOutline.Bar
Waittime = 2.5 -- Time between each loading session
SEC = script.Parent.Parent.Parent.SomethingElseCrafting
AHO = script.Parent.AlreadyHaveOne
Occupied = script.Parent.Parent.Parent.Occupied
Thing = script.Parent.Parent.Parent.Parent.Parent.Inventory.Frame.Item3.EquipOrUnequip:WaitForChild('HasBought')
Wow = Thing.Value


function Flash()

    Occupied.Visible = true
    wait(2)
    Occupied.Visible = false

end


function Crafting()
    wait(Waittime)
    craftbar.Size = UDim2.new(0.25, 0, 1, 0)
    wait(Waittime)
    craftbar.Size = UDim2.new(0.5, 0, 1, 0)
    wait(Waittime)
    craftbar.Size = UDim2.new(0.75, 0, 1, 0)
    wait(Waittime)
    craftbar.Size = UDim2.new(1, 0, 1, 0)

end

function Reset()

    craftbar.Size = UDim2.new(0, 0, 1, 0)

end


function Check()
local Item = script.Parent.Parent.Item.ItemName     
local Item2  = Item2

print("Checking")
if gold.Value >= 2 and Item2.Value >=3 and SEC.Value == false and AHO.Value == false then
    print("Starting")
    gold.Value = gold.Value - 2
    Item2.Value = Item2.Value - 3
    print("Taking Away Items")
    wait(.1)
    SEC.Value = true
    print("Crafting")
    Crafting()
    wait(Waittime)

print("Reseting")

    Reset()
    script.Parent.Sound:Play()
    print("Almost Done")

    SEC.Value = false
    AHO.Value = true

    print("DONE!!")
    Thing.Value = true  --Problem
    print(tostring(Wow))

elseif gold.Value < 2 and Item2.Value < 3 then

    print("NOT ENOUGH!!")


elseif SEC.Value == true then

    Flash()


    end




end




script.Parent.MouseButton1Click:connect(Check)

1 answer

Log in to vote
1
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
8 years ago

You put AHO == false, which I assume the script checks if the value never exists. Try putting AHO.Value

Ad

Answer this question