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

GUI Visibility Error?

Asked by 10 years ago

Hello,

Throughout the past few days, I've been dealing with a bug. In short, I have a 'class' system set up, where when the value gets updated, your character changes.

Then, I wanted it to be if someone respawns on a certain team or has a 'monster' class, it would show a GUI. I did it; it worked in Play Solo mode.

However, the functionality ends there. I went to test it in online mode, and it did not work, the GUI did not show up on respawn, whether I was a monster or not, nor did the class updating script that changes your character, which had worked for the past two months. I removed it, and the character script continued to work.

I later installed an online output monitoring script to see if I could catch the error. I did actually find an output, which was:

"Class is not a valid member of player"

Finally, I added a wait(1.5) function in between the character respawning and the first trace/declaration of the Class StringValue inside the player. It still gave me the same exact error as the last time.

This is the script:

Monsters = {"Zombie","Ogre","Nighthunter","Thing","Imp","Golem","Savage"}
Players = game.Players

print("A")

Players.PlayerAdded:connect(function(Player)
    print("B "..Player.Name)
    Player.CharacterAdded:connect(function(Character)
        print("C")
        wait(1.5)
        x = Player.Class.Value
            if x == "Zombie" or x == "Ogre" or x == "Nighthunter" or x == "Thing" or x == "Imp" or x == "Golem" or x == "Savage" then
                print("D")

                ms = game.ServerStorage.MonsterSelect:clone()
                ms.Parent = Player.PlayerGui
                print("E")

            end 
    end)
end)

print("F")

It was originally a LocalScript, instead of a server-side script, but I had to experiment with different things in hope that I'd get it to work, because originally, I had it running _G variables with LocalScripts, which doesn't work. I'll revert back to a LocalScript format if I can.

Thanks for reading; all replies are appreciated!

1 answer

Log in to vote
0
Answered by
c0des 207 Moderation Voter
10 years ago

Try chaning line 11 to this:

        x = Player:FindFirstChild("Class").Value
0
changing* c0des 207 — 10y
Ad

Answer this question