I am really confused of why this Rank GUI script only works on the studio but not in the real game.
local epicPeople = {"mrhaphap402"}
local swagOn = false
function findEpicPeople(person)
for i,v in pairs(epicPeople) do
if v == person then
return true
end
end
return false
end
function assesIfCan(plr)
if findEpicPeople(plr.Name) == true or plr:GetRankInGroup(3345195) >= -255
then
return true
end
return false
end
local ids = {1,1}
local teams = {""}
local terrorists = {}
function checkTeam(player1)
local team = nil
local tc = nil
for o,b in pairs(game.Teams:GetChildren()) do
if b.TeamColor == player1.TeamColor then
tc = b.Name
end
end
for i,v in pairs(teams) do
if v == tc then
team = i
end
end
local group = ids[team]
return group
end
local player = game.Players.LocalPlayer
function assessRank()
if game.Players.LocalPlayer:IsInGroup(3345195) or not game:FindFirstChild("NetworkServer") then
repeat wait() until game.Workspace:FindFirstChild(player.Name)
repeat wait() until player.Character:FindFirstChild("Head")
if player.Character:FindFirstChild("Rank") then
player.Character.Rank:remove()
end
a = script.Rank:clone()
a.Parent = player.Character
a.Adornee = player.Character.Head
a.Frame.TextLabel.Text = player:GetRoleInGroup(3345195)
local groups = {3965252, 4038679}
for i=1, #groups do
local role = player:GetRoleInGroup(groups[i])
if role ~= "Regimental Recruit" then
a.Frame.Regiment.Text = role
end
end
a.Frame.Name1.Text = player.Name
a.Frame.Name1.TextColor = player.TeamColor
a.Frame.Regiment.TextColor = player.TeamColor
a.Frame.Name1.TextStrokeTransparency = 0
end
if checkTeam(player) then
a.Frame.TextLabel.Text = player:GetRoleInGroup(checkTeam(player))
a.Frame.Regiment.Text = player:GetRoleInGroup(checkTeam(player))
end
repeat wait() until player.Character:FindFirstChild("Humanoid")
player.Character.Humanoid.NameOcclusion = "OccludeAll"
if player.Character:FindFirstChild("Body Colors") then
if player.TeamColor == BrickColor.new("Medium stone grey") or player.TeamColor == BrickColor.new("White") then
player.Character["Body Colors"]:remove()
end
end
end
assessRank()
game.Players.LocalPlayer.Changed:connect(function (prop)
if prop == "TeamColor" then
assessRank()
end
end)

2 comments
Use remote events.
How?