Guys in my script, I used KeyDown which is deprecated, how do I replace it with UserInputService? (I'm Using Local Script) here is the script:
-- This is A local script, works fine but it's deprecated
local plyr = game.Players.LocalPlayer
local char = plyr.Character or plyr.CharacterAdded:Wait()
local torso = char:WaitForChild('HumanoidRootPart')
local mouse = plyr:GetMouse()
mouse.Icon = 'http://www.roblox.com/asset/?id=1278515766'
mouse.KeyDown:connect(function(key) -- Here is the problem
if key == 'e' then -- When I press E
local target = mouse.Target
if target and target:FindFirstChild('Configuration') and target.Configuration:FindFirstChild('Interact') and target.Configuration.Interact.Value >= 1 and mouse.Icon == 'http://www.roblox.com/asset/?id=1278513023' then
if (target.Position - torso.Position).magnitude <= target.Configuration.Interact.Value *1.5 then
print(target.Name) -- Do the thing if all conditions are valid.
end
end
end
end)
Thanks for help.

1 comment
Found the solution, Thanks!