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

How to script movement for a simple imported character?

Asked by 1 year ago

I have imported a simple Soldier rig from Blender. The Rig is animated and I need it to move like a normal roblox character would do. I have tried scripting like:

while true do
    Soldier.RootPart.CFrame=Soldier.RootPart.CFrame*CFrame.new(0,0,-0.1)
    wait(0.1)
end

This makes the Character move but it doesn't work when going uphill/downhill. I just need to know how to make the Soldier Character move around like Normal Roblox Characters. Any help is Highly Appreciated. Thanks in Advance.

1
you can use humanoid:moveto() JustinWe12 723 — 1y
0
Humanoid:Moveto() or Humanoid:Move didn't work at all, because the rig is imported. Its neither R6 or R15. Its a skinned mesh with 64 Bones, including fingers. Please help I'm struggling with this question Shounak123 461 — 1y

1 answer

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

You can use Humanoid:MoveTo() just as what @JustinWe12 said, but Humanoid:Move() is much preferred if you want a humanoid to walk in a direction.

-- Normal Script inside the Soldier Character
local Solder = script.Parent
local Humanoid = Solider:FindFirstChildOfClass("Humanoid")

for _, limb in ipairs(Soldier:GetDescendants()) do
    if limb:IsA("BasePart") then -- if it's a limb (Part, MeshPart, Union, Accessory, etc.)
        limb:SetNetworkOwner(nil) -- so the solider won't lag
    end
end

Soldier.DescendantAdded:Connect(function(limb) -- if a new limb is added to soldier
    if limb:IsA("BasePart") then -- if it's a limb (Part, MeshPart, Union, Accessory, etc.)
        limb:SetNetworkOwner(nil) -- so the solider won't lag
    end
end)

while true do
    Humanoid:Move(Solider:GetPivot().LookVector) -- makes soldier walk forward
    task.wait()
end
0
Unfortunately didn't work, as the Character I have is not in template with roblox's default characters (R6/R15). That may be the reason Humanoid:Move() or Humanoid:Moveto doesn't work. The Character is a skinned mesh with 64 Bones, including a RootPart. I just need it to move around like Humanoid:Move() does. Please. Shounak123 461 — 1y
0
But you said it was 'simple' implying that it's an R6 rig. T3_MasterGamer 2189 — 1y
0
Can you send me the model? So that I will know what to fix other than Humanoid:Move() T3_MasterGamer 2189 — 1y
Ad

Answer this question