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

Why is this broken? {FIXED BY MYSELF XD}

Asked by 9 years ago

EDIT: I made such a stupid mistake, forgive me. I accidently forgot to put Text on one of the lines. Such a stupid mistake I made

I am making this gold giver GUI for my best friend, dragonmaster4111, after his Chatted gold giver broke :c

I have a script that changes your gold into how much you put in the textbox Here is the script:

enter = script.Parent
GoldGiver = script.Parent.Parent.GoldGiver

enter.MouseButton1Click:connect(function()
    local stats = script.Parent.Parent.Parent.Parent:FindFirstChild("leaderstats")
    if stats ~= nil then
        local goldstat = stats:FindFirstChild("Gold")
        if goldstat ~= nil then
            goldstat.Value = tonumber(script.Parent.Parent.GoldGiver.Text)
        end
    end
end)

The only problem is that whenever I press enter with a number inside the box, the value of my gold becomes 0, and I didn't even put 0! Help?

Answer this question