mouse.KeyDown:connect(function(key) if key == "t" and mouse.Target then local hum = mouse.Target.Parent:FindFirstChildOfClass('Humanoid') if hum == nil then hum = mouse.Target.Parent.Parent:FindFirstChildOfClass('Humanoid') end if curpoint == nil then if hum and hum.Parent:FindFirstChild('Head') then curpart = hum.Parent.Head else
Well I can't see the full length of your script, however I can note that KeyDown
is deprecated in favor of the UserInputService
and connect
is deprecated in favor of Connect
.
REVISION (LocalScript Only)
01 | local mouse = game:GetService( "Players" ).LocalPlayer:GetMouse() |
02 | local curpoint = nil |
03 | local curpart = nil |
04 |
05 | game:GetService( "UserInputService" ).InputBegan:Connect( function (input, event) |
06 | if input.KeyCode = = Enum.KeyCode.T and mouse.Target ~ = nil then |
07 | local hum = mouse.Target.Parent:FindFirstChildOfClass( "Humanoid" ) |
08 | if hum = = nil then |
09 | hum = mouse.Target.Parent.Parent:FindFirstChildOfClass( "Humanoid" ) |
10 | end |
11 | if curpoint = = nil then |
12 | if hum and hum.Parent:FindFirstChild( "Head" ) then |
13 | curpart = hum.Parent.Head |
14 | else |
15 | end |
16 | end |
17 | end |
18 | end ) |