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

Can somebody help me this simple script will sometimes work and sometimes not work. Any help?

Asked by
hvcu 3
4 years ago
Edited 4 years ago

i have this script:

local BillBoardGui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")

local roletag = game:GetService("ServerStorage"):WaitForChild("RoleRank")

local GroupID = 5184088

game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local ClonedGui = BillBoardGui:Clone() local ClonedRank = roletag:Clone() ClonedRank.Value = player:GetRoleInGroup(GroupID) ClonedGui.Parent = game.Workspace:WaitForChild(player.Name).Head ClonedRank.Parent = game.Workspace:WaitForChild(player.Name).Head

end) end)

It is located in ServerScriptService

The script sometimes works and sometimes just doesnt

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

This is a normal script and put it in workpace It will get your role from your group and make that you role if you want it like that :D

local commands = {}

function Create(ClassName)
 return function(Properties)
  local Obj = Instance.new(ClassName)
  for i,v in pairs(Properties) do
   if type(i) == 'number' then
    v.Parent = Obj
   else
    Obj[i] = v
   end
  end
  return Obj
 end
end
function HandleCharacter(Player, Character)
 local Custom = Character:WaitForChild('Head'):clone()
 Custom.Name = 'TastiesOverhead'
 Custom.Parent = Character
 Custom.face:Destroy()
 Character.Head.Transparency = 1
 Create'Weld'{
  Name = 'CustomWeld';
  Parent = Custom;
  Part0 = Character.Head;
  Part1 = Custom;
 }
 Create'BillboardGui'{
  Name = 'Nametag';
  Parent = Custom;
  Size = UDim2.new(5, 0, 0.5, 0);
  StudsOffset = Vector3.new(0, 2, 0);
  Create'TextLabel'{
   Name = 'NameLabel';
   BackgroundTransparency = 1;
   Size = UDim2.new(1, 0, 1, 0);
   Position = UDim2.new(0, 0, -0.8, 0);
   Font = 'ArialBold';
   Text = Character.Name;
   TextColor3 = Color3.new(1, 1, 1);
   TextScaled = true;
   TextStrokeTransparency = 1;
  };
  Create'TextLabel'{
   Name = 'RankLabel';
   BackgroundTransparency = 1;
   Size = UDim2.new(1, 0, 0.92, 0);
   Position = UDim2.new(0, 0, 0.2, 0);
   TextTransparency = .1;
   Font = 'SourceSansItalic';
   FontSize = Enum.FontSize.Size14;
   Text = Player:GetRoleInGroup(5184088);
   TextColor3 = Color3.new(1, 1, 1);
   TextScaled = true;
   TextStrokeTransparency = 1;
  };
 }

 Custom.BrickColor = Character.Head.BrickColor
 Character.Head.Changed:connect(function()
  Character.Head.Transparency = 1
  Custom.BrickColor = Character.Head.BrickColor
 end)
 Character.Head.Mesh.Changed:connect(function()
  Custom:WaitForChild('Mesh').MeshId = Character.Head:WaitForChild('Mesh').MeshId
 end)
end

local rainbow = function(callback)
local frequency = 0.1
local i = 0 
while true do wait()
local red = math.sin(frequency*i + 0)*127+128 
local green = math.sin(frequency*i + 2*math.pi/3)*127+128 
local blue = math.sin(frequency*i + 4*math.pi/3)*127+128 
callback(Color3.new(red/255,green/255,blue/255)) i = i+1 
end end 
function HandlePlayer(Player)
 if Player.Character then
  HandleCharacter(Player, Player.Character)
 end
 Player.CharacterAdded:connect(function(Character) HandleCharacter(Player, Character) end)
 if Player.UserId == 0 or Player.UserId == 0 or Player.UserId == 0 or Player.UserId == 0 then
  Player.CharacterAdded:connect(function(char) local label = char:WaitForChild("TastiesOverhead") 
   coroutine.resume(coroutine.create(rainbow),function(color)label.Nametag.RankLabel.TextColor3 = Color3.new(color.r,color.g,color.b)end) 
  end)
 end
end
game.Players.PlayerAdded:connect(function(b)
 HandlePlayer(b)
end)
for i,v in pairs(game.Players:GetPlayers()) do
  HandlePlayer(v) 
end 

I made It so your group id is in there hopefully that solved your problem

0
because if its a local script it would work on all the players not just a single one that might be the problem Nervousmrmonkey2 118 — 4y
0
Acctually, i found that the problem was another script hvcu 3 — 4y
0
btw this works hvcu 3 — 4y
0
ok thx Nervousmrmonkey2 118 — 4y
Ad
Log in to vote
0
Answered by
Lakodex 711 Moderation Voter
4 years ago

Please put your post in a scripting box. You can look up tutorials on how to do it! I will not assist you until you do so.

0
i told him the awser sorry :( Nervousmrmonkey2 118 — 4y
0
Its fine. Lakodex 711 — 4y
0
can u help me with my turret? Nervousmrmonkey2 118 — 4y
0
Me? add me on discord : Devamspion#7812 Lakodex 711 — 4y
0
Im not allowed i just asked the question though Nervousmrmonkey2 118 — 4y

Answer this question