Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does this script is not working on player.Character.HumanoidRootPart?

Asked by 2 years ago

Hello, I just wrote a script that should "push" players or npcs. But it works only on NPCs. I don't know why. Here the script: (local script)

local mouse = game:GetService("Players").LocalPlayer:GetMouse()

script.Parent.Activated:Connect(function()
    if mouse.Target then
        local model = mouse.Target.Parent
            print(model)
        if model:FindFirstChild("HumanoidRootPart") then
            if not model.HumanoidRootPart:FindFirstChild("PushR") then
                local f = Instance.new("BodyAngularVelocity")
                f.Name = "PushR"
                f.MaxTorque = Vector3.new(1000000,1000000,1000000)
                f.Parent = model.HumanoidRootPart
                f.AngularVelocity = Vector3.new(50,50,50)
            end
        end
    end
end)

Help please, Thanks!

Answer this question