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

My Text Button Isn't Removing, How Come? Can Somebody Help Me?

Asked by
ImfaoXD 158
9 years ago

Its still doesn't work, I put it in the text button and still its 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 word "Unlock" labeled in the text button from the image button when a player have 10 points or higher. I want the text button to remove, so the player can see the image button when they have 10 points or higher. I just want the text button to remove when a player reach the requirement points. Please 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/8la4ak

And also try out this game if you want to see how's the gui look like, even though I'm not making a pokemon game. I'm trying to make an rpg game that unlock characters when a player have 10 points or more. Here is the link:

http://www.roblox.com/games/30876086/Pokemon-Legends

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

01local player   = game.Players.LocalPlayer
02local stats    =  player:WaitForChild("leaderstats")
03local statname = "Points"
04local guiname  = "ScreenGui"
05 
06stats:WaitForChild(statname).Changed:connect(function()
07    print("Changed")
08    if stats:FindFirstChild(statname) then
09        print("IT EXISTS!")
10        if stats:FindFirstChild(statname).Value == 10 then
11            print("VALUE EQUALS 10!")
12            if player:WaitForChild("PlayerGui"):FindFirstChild(guiname) then
13                print("found the gui")
14                player.PlayerGui:FindFirstChild(guiname):Destroy()
15            end
16        end
17    end
18end)
0
Does output show any errors? ISellCows 2 — 9y
0
No, But It Still Doesn't Work. What Should I Do? ImfaoXD 158 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

I found out where the mistake in the script is. At line 3, you said

1local statname = 'Points'

Well apparently you made a new value called "statname". + Here's another fault. You said on line 2

1local stats = player:WaitForChild('leaderstats')

You said "stats" and what you said on line 3 is "stat", which apparently doesn't match.

I don't know what you are doing, but I get a small part of it, which is making stats.

If that's the case, continue on line 2 and put this

1local points = Instance.new('IntValue')
2points.Parent = stats
3points.Name = 'Points'
4--If you want to make a new GUI
5local guiname = Instance.new('ScreenGui')

In Line 10

1if points.Value >= 10 then

Hope this helps :)

Ad

Answer this question