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

why won't my function connect and text appear?

Asked by 7 years ago

I've created a script that, upon click of "ClickyClick", makes a TextLabel gradually increase its transparency and all of my prints work except the text doesn't appear

01function ChangeOfMoneyGui(clicker)
02    db = 0
03    print("function connected")
04    if db == 0 then
05        db = 1
06        print("debounce active")
07        local plrg = clicker:FindFirstChild("PlayerGui")
08        local mc = plrg.ChangeOfMoney.MoneyChangeFrame.MoneyChange
09        local tt = mc.TextTransparency
10        local st = mc.TextStrokeTransparency
11        visible = false
12        if visible == false then
13            print("visible = true")
14            visible = true
15            appear(tt)
View all 41 lines...
0
messed up on title, function *did* connect except the text just won't appear creeperhunter76 554 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

The text doesn't appear because you are never updating its transparency. In the code

1function appear(transparency)
2    print("appear function called")
3    for i = 1, 0, .05 do
4    transparency = i
5    end
6end

you are only updating the variable transparency and not the actual transparency of the label's text. To make this work, consider using this function

1function appear(label)
2    print("appear function called")
3    for i = 1, 0, .05 do
4        label.TextTransparency = i
5        label.TextStrokeTransparency = i
6        wait()
7    end
8end

and calling it by passing the label mc as an argument. Do similarly for disappear. Keep in mind you will want to call wait upon each loop iteration to prevent the text from appearing instantly.

0
thanks, worked! creeperhunter76 554 — 7y
0
No problem MightyBaconOverlord 253 — 7y
Ad
Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

You get the Value of the Transparency and not set it to the new value and you did this loop:

1for i = 1, 0, .05 do

this will not decrease i so it gets visible again you need to do the loop like this:

1for i = 1, 0, -.05 do

try this :

01function appear(object)
02    print("appearing")
03    for i = 1, 0, -.05 do
04        object.TextTransparency = i
05        object.Transparency = i
06    end
07end
08 
09function dissappear(object)
10    print("dissappearing")
11    for i = 0, 1, 0.5 do
12        object.TextTransparency = i
13        object.Transparency = i
14    end
15end
View all 38 lines...

Answer this question