#Click to fling - attempt to index nil with 'Parent'

9 messages · Page 1 of 1 (latest)

mortal sand
#

I'm creating a tool, that once you click on a player, it'll fling + ragdoll them - I have another tool which when it hits the player, it flings them and I'm moving them into another tool which is clicking instead of on hit

Error: Players.User.Backpack.Flinger.fling:7: attempt to index nil with 'Parent'

here is the code:

Error is line 7, aka 'if part.Parent:IsA' etc etc

local RemoteEvent = script.Parent:WaitForChild("RemoteEvent")
local TargetTorso = nil
local Using       = false
local FlingAmount = 230

function CheckForTargetHead(part)
    if part.Parent:IsA'Model' and part.Parent:FindFirstChild'Humanoid' then
        local char = part.Parent
        local head
        if char:FindFirstChild'Head' then
            head = char.Head
            local blender = char.Head
            if not (blender == nil) then
                local bv = Instance.new("BodyVelocity")
                bv.P = 1250
                bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
                bv.Velocity = blender.CFrame.lookVector*-FlingAmount
                bv.Parent = blender
                wait(.05)
                bv:Destroy()
                wait(.2)
            end
        end
    end
end
proud hollow
#

part.Parent:FindFirstChild("Humanoid")

#

these need to be fixed

mortal sand
#

oh

mortal sand
proud hollow
#

that means it cant find a part

#

can u show the full script

#

that doesnt show where you use the function (part)