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

How to access info between scripts?

Asked by
Ulysies 50
8 years ago

I am trying to transfer information between two separate scripts. One script has an ifstatement and if there is more than one player in the game the game begins. I have a button that is supposed to in a sense, override the 1 or more player system, using the the TextTansparency of a TextLabel.

if game.Players.NumPlayers > 1 or game.StarterGui.Shop.override.TextLabel.TextTransparency < 1 then
        for _,v in pairs(game.Players:GetChildren()) do 
            v.PlayerGui.Ament.TextLabel.Text = "Choosing Game..." 
        end

This should work? It doesn't say there are any problems with it.. but it wont work. Please help!

1 answer

Log in to vote
0
Answered by 8 years ago
if( game.Players.NumPlayers > 1 or game.StarterGui.Shop.override.TextLabel.TextTransparency < 1 ) then

        for _,v in pairs(game.Players:GetPlayers()) do-- getplayers returns a table  containing all the players from the server

            v.PlayerGui.Ament.TextLabel.Text = "Choosing Game..."

        end

--http://wiki.roblox.com/index.php?title=API:Class/Players I am not certain that there is more to fix in the code, but I do know you should use getPlayers vs get Children From a print statement, I got a different memory value than the get children, and since players has a function that gets an array of people in the server, you should be able to use the advanced for loop and effect the playergui textlabel text.

Ad

Answer this question