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...
local petrifier = script.Parent local badEndingClone = game.ServerStorage["Bad Ending."]:Clone() local texttransparency = badEndingClone.TextLabel.TextTransparency local textStrokeTransparency = badEndingClone.TextLabel.TextStrokeTransparency local function steppedOn(part) local parent = part.Parent if game.Players:GetPlayerFromCharacter(parent) then print(parent.Name .. " is being petrified!") local player = game.Players:FindFirstChildOfClass("Player") -- (there's coding here) print("Bad ending thingy coming up") badEndingClone.Parent = player.PlayerGui for a = 1, 0, -0.1 do texttransparency = (a) print(texttransparency) wait(1) end end end petrifier.Touched:connect(steppedOn)
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:
local petrifier = script.Parent local badEndingClone = game.ServerStorage["Bad Ending."]:Clone() local text = badEndingClone.TextLabel local function steppedOn(part) local parent = part.Parent if game.Players:GetPlayerFromCharacter(parent) then print(parent.Name .. " is being petrified!") local player = game.Players:FindFirstChildOfClass("Player") -- (there's coding here) print("Bad ending thingy coming up") badEndingClone.Parent = player.PlayerGui for a = 1, 0, -0.1 do text.TextTransparency = (a) print(text.TextTransparency) wait(1) end end end petrifier.Touched:connect(steppedOn)