Oji0721
(red_Jack)
September 30, 2022, 8:07am
#1
Like I want to make a local script that if you leave the group in game the GUI will disappear but IDK if my code is write I have a 2 codes here.
if Player:IsInGroup(ID) then
while true do
wait(3)
GUI.Frame.EmployeeTeam.Visible = Player:IsInGroup(ID)
end
end
or
while true do
wait(3)
GUI.Frame.EmployeeTeam.Visible = Player:IsInGroup(Employee)
GUI.Frame.ManagerTeam.Visible = Player:IsInGroup(Manager)
-- So I don’t need to make a elseif statement over and over
end
1 Like
Tetraic
(Axius)
September 30, 2022, 8:13am
#2
If players are losing their ranks, its for a good reason.
If you demote a user, kick them from the game.
Cheers!
Oji0721
(red_Jack)
September 30, 2022, 8:13am
#3
Check the code again and wdym kick the player if you demoted?
Apicphis
(Apicphis)
September 30, 2022, 8:14am
#4
When a player leaves a group, it won’t update instantly in-game. You need to kick them from the game.
Tetraic
(Axius)
September 30, 2022, 8:14am
#5
Usually, when a player leaves a group, its for a good reason, and they will most likely leave themselves, its not of big concern, if you purposefully demoted them, just invoke a Kick on them.
Oji0721
(red_Jack)
September 30, 2022, 8:15am
#6
It updated a bit a time it estimates about 30-50 seconds because I tested it in my alt account.
Tetraic
(Axius)
September 30, 2022, 8:16am
#8
According to the API
Localscripts can instantly tell if a player has left the group using the normal Functions.
Scripts only update after they left.
NEVER use the client for Rank related events.
In other words, you dont need to check, if you really want to remove whatever GUI they have, just kick them from whatever sever they’re in.
Oji0721
(red_Jack)
September 30, 2022, 8:18am
#9
So how do I write my code?
Just ignore this sentence blahblahblah
Tetraic
(Axius)
September 30, 2022, 8:19am
#10
You dont, its not possible to check if they left the group WHILE they’re playing the game, the game will only know their rank upon joining a server.
:IsInGroup()
Oji0721
(red_Jack)
September 30, 2022, 8:21am
#11
So you mean that I can’t make a script thats if the player leaves the group the GUI will get visible = false right?
Tetraic
(Axius)
September 30, 2022, 8:22am
#12
Yes, the server doesnt know if they left the group until they’ve left the game, its better to kick them
Oji0721
(red_Jack)
September 30, 2022, 8:23am
#13
But I’m making this with local script not server script
Tetraic
(Axius)
September 30, 2022, 8:33am
#15
Refer to this post. Its better to kick them because you cannot trust the client with this kind of thing, having a loop constantly checking for something is a huge HUGE nono
Oji0721
(red_Jack)
September 30, 2022, 8:33am
#16
And the Player:IsInGroup
is returning true and false too
Tetraic
(Axius)
September 30, 2022, 8:38am
#18
It will always return true on the server, having checks to see if they left that group while ingame is impossible on the server
Tetraic
(Axius)
September 30, 2022, 8:50am
#21
Because you’re using a localscript, which does update it live, like i said almost 4 times now
Oji0721
(red_Jack)
September 30, 2022, 8:51am
#22
Yeah but I will use a local script to wrute this codes
Oji0721:
if Player:IsInGroup(ID) then
while true do
wait(3)
GUI.Frame.EmployeeTeam.Visible = Player:IsInGroup(ID)
end
end
or
while true do
wait(3)
GUI.Frame.EmployeeTeam.Visible = Player:IsInGroup(Employee)
GUI.Frame.ManagerTeam.Visible = Player:IsInGroup(Manager)
-- So I don’t need to make a elseif statement over and over
end