Hey guys, so I'm trying to make a script for a TTT server that I'm staff on, and what I want it to do is when I press "I" it will slap the target I'm looking at and then in the chat "Are you afk?", as a "check afk" script. What I have now is this (and I don't know if I'm doing this right, should it be in a hook or a function?):
hook.Add( "Tick", "CheckAFK", function()
local ply = LocalPlayer()
local trace = util.GetPlayerTrace( ply )
local traceRes = util.TraceLine( trace )
if traceRes.HitNonWorld then
local target = traceRes.Entity
if target:IsPlayer() then
if ply:input.WasKeyPressed( I ) then
end
end
end
end)
I don't know if this is right or not, and if it is, how do I continue it?
(If you need any clarification, just ask
)