Hello, I'm a beginner scripter.
I just scripted a overhead gui, its work but I want it to change the color and text when you changed team, the text is fine but the color won't change when I change team.
Here's my code, feel free to correct my script.
groupid = 3359981 aos = "" game.Players.PlayerAdded:connect(onPlayerRespawned) function onPlayerRespawned(newPlayer) wait(0.5) local gui = script.Rank:clone() gui.Parent=newPlayer.Character.Head gui.Adornee=newPlayer.Character.Head local rank=gui.Frame.TextLabel rank.Text = newPlayer:GetRoleInGroup(groupid) local name=gui.Frame.Name1 name.Text = newPlayer.Name if newPlayer.name == "Arifafeef" then name.Text = "[President] Arifafeef" -- Custom Nickname if newPlayer.TeamColor == BrickColor.new("New Yeller") then -- Detects the player's team name.TextColor3 = Color3.new(106, 57, 9) -- Changes the rank color but not works rank.Text = newPlayer:GetRoleInGroup(3352821) -- Changes the text (works) -- AOS (Arrest on Sight) Manager- if newPlayer.name == aos then rank.TextColor3 = Color3.new(255, 0, 0) rank.TextStrokeTransparency = 0.1 name.TextColor3 = Color3.new(91, 0, 0) name.TextStrokeColor3 = Color3.new(91, 0, 0) name.TextStrokeTransparency = 0.2 rank.Text = "[AOS] Arrest On Sight" end end end end function onPlayerEntered(newPlayer) newPlayer.Changed:connect(function (property) if (property == "Character") then onPlayerRespawned(newPlayer) end end) end game.Players.PlayerAdded:connect(onPlayerEntered)
Pictures :
For more infomation, click here https://i.imgur.com/OJmDZI2.png
When I'm in citizen team https://imgur.com/a/iOKSp
When I'm in CNN team https://imgur.com/a/L4jj6 (Its should change the name color but idk why, you can check the code)
What it supposed to be https://imgur.com/a/d549I (I do not use script for this, this just for show)
Please help me, if you don't know what I'm saying, feel free to DM me then I will explain. ArifAfeef#8789
The problem is, that Color3.new
takes a RGB value from 0 to 1. This would be useful for making green like Color3.new(0, 1, 0)
. So, how do we have Color3 take a color from RGB? Use Color3.fromRGB(0, 255, 0)
. (i like green dont ask me why i keep having that as an example). So, your fixed script should look like
groupid = 3359981 aos = "" game.Players.PlayerAdded:connect(onPlayerRespawned) function onPlayerRespawned(newPlayer) wait(0.5) local gui = script.Rank:clone() gui.Parent=newPlayer.Character.Head gui.Adornee=newPlayer.Character.Head local rank=gui.Frame.TextLabel rank.Text = newPlayer:GetRoleInGroup(groupid) local name=gui.Frame.Name1 name.Text = newPlayer.Name if newPlayer.name == "Arifafeef" then name.Text = "[President] Arifafeef" -- Custom Nickname if newPlayer.TeamColor == BrickColor.new("New Yeller") then -- Detects the player's team name.TextColor3 = Color3.fromRGB(106, 57, 9) -- Changes the rank color but not works rank.Text = newPlayer:GetRoleInGroup(3352821) -- Changes the text (works) -- AOS (Arrest on Sight) Manager- if newPlayer.name == aos then rank.TextColor3 = Color3.fromRGB(255, 0, 0) rank.TextStrokeTransparency = 0.1 name.TextColor3 = Color3.fromRGB(91, 0, 0) name.TextStrokeColor3 = Color3.fromRGB(91, 0, 0) name.TextStrokeTransparency = 0.2 rank.Text = "[AOS] Arrest On Sight" end end end end function onPlayerEntered(newPlayer) newPlayer.Changed:connect(function (property) if (property == "Character") then onPlayerRespawned(newPlayer) end end) end game.Players.PlayerAdded:connect(onPlayerEntered)
Alsp, :connect is deprecated. use :Connect, and indent properly (are you happy people complaining about my bio cuz i didnt tell the person to see it).