Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Guys, Its Still Doesn't Work. What Did I Do Wrong?

Its still doesn't work, what do I do wrong? What I'm trying to make the script do is to remove the text button with the "?" which is the "Unlock" as labeled in the text button from the image button when a player have 10 points or higher. But the text button is in the image button. I just want the text button to remove when a player have 10 point or higher. Check the link below to see what I'm talking about.

Also here is the screenshot to see what I'm talking about: http://prntscr.com/8l71a6

Also here is the script that many people from script helpers have helped me and I'm really thankful for their helps!

local player   = game.Players.LocalPlayer 
local stats    =  player:WaitForChild("leaderstats") 
local statname = "Points" 
local guiname  = "ScreenGui" 

stats:WaitForChild(statname).Changed:connect(function()
    print("Changed")
    if stats:FindFirstChild(statname) then 
        print("IT EXISTS!")
        if stats:FindFirstChild(statname).Value == 10 then 
            print("VALUE EQUALS 10!")
            if player:WaitForChild("PlayerGui"):FindFirstChild(guiname) then 
                print("found the gui")
                player.PlayerGui:FindFirstChild(guiname):Destroy() 
            end
        end
    end
end)

Thank You

1 answer

✓ Accepted answer

If all you want to do is remove the TextLabel, change the

player.PlayerGui:FindFirstChild(guiname):Destroy()

line to

script.Parent.Parent:WaitForChild("TextLabel"):Destroy()

When you destroy the entire ScreenGui, you also destroy all its children, including the text label AND the image.

I'm assuming that's what's printing "Knight," and I'm also assuming the script executing this is that LocalScript in your userdata, but if this wasn't what you were looking for, just rephrase the question.

This discussion is preserved as it was. New answers, comments, and votes are closed.