This script is meant to turn a crosshair red when the player's mouse is hovering over another player's torso:

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local character = Player.CharacterAddedWait()
local n = character.Name

local Target2 = n:GetDescendants('Torso')

local ScreenGui = script.Parent:WaitForChild('WeaponHud')
 local Mid = ScreenGui:WaitForChild('Mid')
 
game:GetService('RunService').RenderStepped:Connect(function()
 local X = Mouse.X
 local Y = Mouse.Y
 
 if Mouse.Target then 
  if Mouse.Target.Name == 'Target2' then 
   Mid.ImageColor3 = Color3.new (255,5,5)
   Mid.Position = UDim2.new(0,X,0,Y + 50)
  else 
   Mid.ImageColor3 = Color3.new(255,255,255)
  end
 end
end)

It doesn't work. Why?

2 comments

0

On Line 3, you forgot to put a colon between wait and CharacterAdded.

0

oh, is that it?