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

My Text Button Isn't Still Working Properly, Can Somebody Check What Could I Have Done Wrong?

Asked by
ImfaoXD 158
8 years ago

Guys, thank you for your helps. I am really appreciated your help a lot! But when i put the script into the text button, it still not working. How come? Did i put it in the wrong place? Can you guys help me find the solution?

But please check this screen shot that i took, so you can see what i'm talking about:

http://prntscr.com/8lnoym

Also here is the script if you need to check:

local player = game.Players.LocalPlayer
repeat wait() until player.Character -- So no errors occur later on ;)

local stats = player:WaitForChild('leaderstats')
local statsname = "Points"
local guiname = "ScreenGui"

stats[statsname].Changed:connect(function()
    print('Changed')
    if stats:FindFirstChild(statsname) then
        print('IT EXISTS!')
        if stats[statsname].Value >= 10 then -- If the value is more than or equals to 10 then do:
            print('VALUE EQUALS 10!')
            if player:WaitForChild('PlayerGui'):FindFirstChild(guiname) then
                print('found the gui')
                player.PlayerGui[guiname]:Destroy()
            end
        end
    end
end)

Answer this question