I have a script that SHOULD make the chosen Gui Text become a little more transparent 1/10 of a second when I say the key text.. it has no errors but won't work. I've tried a Server Side Script and a Local Script.. but it still won't work. Any help?
A = script.Parent admin = { "SecretShadowLeague" } game.Players.PlayerAdded:connect(function(nP) for _,v in pairs(admin) do if nP.Name == v then nP.Chatted:connect(function(msg) if msg == "Computer Load O1" then A.O1.TextTransparency = 0.9 wait(0.1) A.O1.TextTransparency = 0.8 wait(0.1) A.O1.TextTransparency = 0.7 wait(0.1) A.O1.TextTransparency = 0.6 wait(0.1) A.O1.TextTransparency = 0.5 wait(0.1) A.O1.TextTransparency = 0.4 wait(0.3) A.O1.TextTransparency = 0.3 wait(0.1) A.O1.TextTransparency = 0.2 wait(0.1) A.O1.TextTransparency = 0.1 wait(0.1) A.O1.TextTransparency = 1 end end) end end end)
Any help?
Something seems a little off here. If this is in a GUI, then you don't need to be using the PlayerAdded event to get the player. As the objects in StarterGui are copied into the PlayerGui object in every player, you can determine the player from that.
If your structure is:
You will be able to determine the player by doing this:
player = script.Parent.Parent.Parent.Parent
Or, if in a LocalScript, you can just do this
player = game.Players.LocalPlayer
Alright, so with that out of the way, we can move on to the next problem: The way you're changing the transparency is super inefficient. You should be using for loops. Also, you are making the transparency almost solid, and then setting it to completely transparent in the code that you have there.
Here's an example with a for loop (assuming A
is your TextLabel):
for i=1, 0, -0.1 do -- Start at 1, go to 0, with an increment of negative 0.1 A.TextTransparency = i wait(0.1) end
You're going to need to modify the code above to work with your own hierarchy, but you should be able to apply the concepts here into your code.
@Previous That would just clean it up, the problem is the
A.01.Transparency = (WhateverHere)
Notice how the 1. is blue? You have to call it something else like A.AA or A.AB or A.BC for it to work because the number messes it up. Don't take what I say for granted though, I'm still new myself and might be wrong.
Locked by JesseSong
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?