Whenever I try to use this script it gives me the error ServerScriptService.grabhandler:9: attempt to index nil with 'FindFirstChild' - Server - grabhandler:9
local repstore = game:GetService("ReplicatedStorage")
local message = repstore.grab
message.OnServerEvent:Connect(function(player)
print("something happened")
local char = player.Character
local arm = char:FindFirstChild("RightArm")
local armattach = arm:FindFirstChild("RightGripAttachment")
local hrp = char:FindFirstChild("HumanoidRootPart")
if not hrp then return end
local hitbox = Instance.new("Part")
local weld = Instance.new("WeldConstraint")
hitbox.Parent = game.Workspace
hitbox.Massless = true
hitbox.CanCollide = false
hitbox.CastShadow = false
hitbox.Transparency = 1
hitbox.Size = Vector3.new(3, 3, 4)
local forwardOffset = 2
hitbox.CFrame = hrp.CFrame * CFrame.new(0, 0, -forwardOffset)
weld.Parent = hitbox
weld.Part0 = hitbox
weld.Part1 = hrp
hitbox.Touched:Connect(function(part)
local humanoid = part.Parent:FindFirstChild("Humanoid")
if humanoid then
print("hum found")
end
local attachment = humanoid.Parent:FindFirstChild("Torso"):FindFirstChild("WaistBackAttachment")
local weld = Instance.new("RigidConstraint")
weld.Parent = attachment
weld.Attachment0 = attachment
weld.Attachment1 = armattach
end)
task.wait(1)
hitbox:Destroy()
end)