I can't figure this out. Roblox is saying Player is unknown, and required rank is unknown...
requiredRank = "250" local groupId = 4274644 if player:IsInGroup(groupId) and player:GetRoleInGroup(groupId) >= requiredRank then game.StarterGui.Rooms.Enabled = true game.StarterGui.StaffTeleport.Enabled = true end
I want to make it so Moderators and up can see the GUI when joining the game, but members below don't see it.
Thank you for helping :P
StarterGui
. This service is basically where PlayerGui
clones out of when the player first joins and when they respawn. In other words, for the changes to show, you'll have to reset their character. But we want to make the changes happen without resetting, no? To prevent that, we can use the PlayerGui
, if we edit any GUIs in there, they will show instantly, and any LocalScript
s placed in there will start to run.local requiredRank = 250 -- it's a number, not a string. and use local variables! global variables are bad practice local groupId = 4274644 local client = game.Players.LocalPlayer if client:GetRoleInGroup(groupId) >= requiredRank then client.PlayerGui.Rooms.Enabled = true client.PlayerGui.StaffTeleport.Enabled = true end
Your script is find... But you are Accessing StarterGui this is basically enabling The Gui's you want staff members too have. To be enabled. in the StarterGui
Instead of using this
game.StarterGui.Rooms.Enabled = true
game.StarterGui.StaffTeleport.Enabled = true
use this.
player.PlayerGui.Rooms.Enabled = true
player.PlayerGui.StaffTeleportEnabled = true
****ALSO: How are you accessing player. You should be using a PlayerAdded Function if you are accessing player (In a normal script.)****