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

Trying to make a group GUI that only group members can see... so whats wrong with this?

Asked by
Ulysies 50
9 years ago
function yup(newPlayer)
if newPlayer:IsInGroup(1156513) then
    game.StarterGui.Bar.OpenClose.Visible = true
    end 
end


game.Players.ChildAdded:connect(yup)


0
You made your changes in StarterGui, but StarterGui is not what the player is seeing. StarterGui is simply a holder used to store GUIs that will later be cloned into a player's PlayerGui, each time they respawn. GUIs in StarterGui are only visible in studio mode for editing purposes. Perci1 4988 — 9y

2 answers

Log in to vote
1
Answered by 9 years ago

I believe I found your error, but just incase I remade it (and tested it) to make sure it works and will tell you everything you needed to do. Soooo....

Part 1 (What I think your error was) change the script to

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        if player:IsInGroup(1156513) then
            player.PlayerGui.Bar.OpenClose.Visible = true
        end
    end)    
end)

Why? Your script would work if you changed game.StarterGui on line 4 to newPlayer, I haven't had much experience with functions like that so I remade the script.

Test the script above now, if it does not work (which if you set up your variables right then it shouldn't) then read the below

If the script above doesn't work, then this means you didn't set up the variables right. So 1.Make sure this script is in the workspace, it can be named anything you want it to 2.Set up your gui like this according to your script

StarterGui
    Bar (<- Is a screengui)
        OpenClose(<- is a frame, textbox, textlabel, textbutton, imagebutton, imagelabel)

Now test it again

Why does this work? The script you made, besides the fact that the script needed some fixing, was not aligned with you variables. Chances were that you didn't have an item named bar or it was the wrong classname. Now, assuming that you are already working with group scripts, I assume you will be able to change the variables to fit the script if you choose to change the gui. Happy Scripting!

Ad
Log in to vote
-2
Answered by 9 years ago

Tips: 1 - change ChildAdded to PlayerAdded. 2 - i'm not sure, but change the (yup) to (newPlayer).

Answer this question