I'm trying to make text fade in, but the transparency of the text just refuses to change. I feel like I'm being a huge idiot here, but here's the script...
01 | local petrifier = script.Parent |
02 | local badEndingClone = game.ServerStorage [ "Bad Ending." ] :Clone() |
03 | local texttransparency = badEndingClone.TextLabel.TextTransparency |
04 | local textStrokeTransparency = badEndingClone.TextLabel.TextStrokeTransparency |
05 |
06 | local function steppedOn(part) |
07 | local parent = part.Parent |
08 | if game.Players:GetPlayerFromCharacter(parent) then |
09 | print (parent.Name .. " is being petrified!" ) |
10 | local player = game.Players:FindFirstChildOfClass( "Player" ) |
11 | -- (there's coding here) |
12 | print ( "Bad ending thingy coming up" ) |
13 | badEndingClone.Parent = player.PlayerGui |
14 | for a = 1 , 0 , - 0.1 do |
15 | texttransparency = (a) |
The issue here is actually pretty simple. Let me try to explain:
on line 3, local texttransparency = badEndingClone.TextLabel.TextTransparency
, you're changing a value named "texttransparency" to the current text's transparency. When you later type texttransparency = (a)
, You're not changing the text's transparency, your just changing a value with a similar name. You're doing the same thing with textstroketransparency. If you don't get what I'm saying, then try using this script instead:
01 | local petrifier = script.Parent |
02 | local badEndingClone = game.ServerStorage [ "Bad Ending." ] :Clone() |
03 | local text = badEndingClone.TextLabel |
04 |
05 | local function steppedOn(part) |
06 | local parent = part.Parent |
07 | if game.Players:GetPlayerFromCharacter(parent) then |
08 | print (parent.Name .. " is being petrified!" ) |
09 | local player = game.Players:FindFirstChildOfClass( "Player" ) |
10 | -- (there's coding here) |
11 | print ( "Bad ending thingy coming up" ) |
12 | badEndingClone.Parent = player.PlayerGui |
13 | for a = 1 , 0 , - 0.1 do |
14 | text.TextTransparency = (a) |
15 | print (text.TextTransparency) |