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

Gui property change on typing. [closed]

Asked by 10 years ago

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?

0
Please try titling your question more appropriately. "This won't work" is not a question, and doesn't tell us anything about what you're asking. Please change it. User#11893 186 — 10y

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?

2 answers

Log in to vote
2
Answered by 10 years ago

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:

  • Player
    • PlayerGui
      • ScreenGui
        • Frame
          • TextLabel
          • Script

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.

0
What I want is for the script to do the transparency thing for when I, and only I, say the key text. Sorry for not stating that. SecretShadowLeague 0 — 10y
0
Just take what I gave in my answer and apply it to your specific situation. Add an if statement at the top when you get the player, and check if player.Name is your name. Then, add a connection for the Chatted event, and so on. User#11893 186 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

@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.

0
The thing you call 01 is actually a capital O not 0 SecretShadowLeague 0 — 10y
0
True, and now that I think about that that's probobly just this site. PartynaderNo7 15 — 10y