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
The parent of a player's character is the Workspace, not the player.
local sp = script.Parent local player = game.Players.LocalPlayer local mouse = player:GetMouse() local teamColor = BrickColor.new("White") while wait(.1) do if mouse.Target then if game.Players:GetPlayerFromCharacter(mouse.Target.Parent) then if game.Players[mouse.Target.Parent.Name].TeamColor == teamColor then sp.Visible = true else sp.Visible = false end elseif game.Players:GetPlayerFromCharacter(mouse.Target.Parent.Parent) then if game.Players[mouse.Target.Parent.Parent.Name].TeamColor == teamColor then sp.Visible = true else sp.Visible = false end else sp.Visible = false end end end