The script below is a script that is a child of a tool. It is supposed to show who is friend or foe by changing the mouse icon whenever you are hovering your mouse over somebody. Right now, It can only find out who is a friend by finding the torso color of who the mouse is hovering above. I want it to find out who is friend or foe by finding out their team color so that whoever is on your team is a friend and whoever is on the opposite team is a foe. I have tried changing local torso to hit.Parent.TeamColor and remove BrickColor but that didn't work. I am not good at scripting.
So please make it find friend or foe by finding their team color not torso brick color! Thanks! :D
bin = script.Parent normal = "http://www.roblox.com/asset/?id=something1" friendly = "http://www.roblox.com/asset/?id=something2" enemy = "http://www.roblox.com/asset/?id=something3" function Run(mouse) mouse.Icon = normal local hit = mouse.Target if (hit == nil) then return end local h = hit.Parent:FindFirstChild("Humanoid") if h ~= nil then local torso = hit.Parent.torso if torso ~= nil then if h.Health > 0 then if (torso.BrickColor == bin.Parent.Torso.BrickColor) then mouse.Icon = friendly elseif torso.BrickColor ~= bin.Parent.Torso.BrickColor then mouse.Icon = enemy end end end end end
To edit the player's mouse icon, the script inside the tool will have to be a local script. You can then get the player through the target with GetPlayerFromCharacter, and then get that player's team.
This is an example of a local script you can use inside the tool (once you have edited the mouse icon ids):
local normal = "http://www.roblox.com/asset/?id=something1" local friendly = "http://www.roblox.com/asset/?id=something2" local enemy = "http://www.roblox.com/asset/?id=something3" local mouse = game.Players.LocalPlayer:GetMouse() mouse.Move:Connect(function() local targ = mouse.Target if targ then local plr = game.Players:GetPlayerFromCharacter(targ.Parent) if plr then if plr.Team == game.Players.LocalPlayer.Team then mouse.Icon = friendly else mouse.Icon = enemy end elseif mouse.Icon ~= normal then mouse.Icon = normal end end end)