I'm trying to make it to where when you hover over a player, if he/she is part of a specific team, it'll show a specific GUI on him/her, but I keep getting an error saying, "TeamColor is not a valid member of Workspace" in the Developer's Console. Here's the script (it's a LocalScript inside the GUI I want to appear if the person is part of the team):
local sp = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local teamColor = BrickColor.new("White")
while wait() do
if mouse.Target then
if mouse.Target.Parent:FindFirstChild("Humanoid") then
if mouse.Target.Parent.Parent.TeamColor == teamColor then
sp.Visible = true
else
sp.Visible = false
end
elseif mouse.Target.Parent.Parent:FindFirstChild("Humanoid") then
if mouse.Target.Parent.Parent.Parent.TeamColor == teamColor then
sp.Visible = true
else
sp.Visible = false
end
else
sp.Visible = false
end
end
end

3 comments
Also, you don't really need to check 30 times a second. Checking every 0.5 seconds should be quick enough for your needs.
I'd argue that half a second is too slow. Personally, I'd go with 1/10th of a second.
Thank you very much! +1'd your Reputation!