Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make it so that the weapon GUI is only open to people in that group?

This is my basic script. (I know the false and true should be switched. I was just testing if it worked.) It's still showing up to me, though, and I'm in that group..

 if (player:IsInGroup(3491785) == true) then

game.StarterGui.StatsBar.Visible = false

else

game.StarterGui.StatsBar.Visible = true

end

1 comment

0

use PlayerGui, not StarterGui

3 answers

✓ Accepted answer

Once the game starts running, starter gui clones everything to the players playergui, so thats why its not working. Try using this:

if (player:IsInGroup(3491785) == true) then
	game.PlayerGui.StatsBar.Visible = false
else
	game.PlayerGui.StatsBar.Visible = true
end

2 comments

0

Thats not what I meant, PlayerGui isn't a child of the DataModel(game),

0

You want to do "game.Players.LocalPlayer.PlayerGui.StatusBar.Visible"

I think it's the true that's affecting it

Try this

 if player:IsInGroup(3491785) then

We'll change

if (player:IsInGroup(3491785) == true) then
   game.StarterGui.StatsBar.Visible = false
   else
   game.StarterGui.StatsBar.Visible = true
end

To

local Player = game:GetService("Players").LocalPlayer

if Player:IsInGroup(3491785) then
   Player.PlayerGui.StatsBar.Visible = false
   else
   Player.PlayerGui.StatsBar.Visible = true
end

Basically you're not correctly defining stuff like the player and you're changing the StarterGui which doesn't update to the player live.

3 comments

0

remove the game. on the second script and you're good

0

don't forget for the players service, its best to retrieve it with :GetService("Players")

0

Oh yeah I fixed it.

This discussion is preserved as it was. New answers, comments, and votes are closed.