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

How to Change Character Limbs Without Animation?

Asked by 9 years ago

(Hopefully This doesn't sound like a request, I'm just trying to get an example)

How would I make it so that whenever I press down a key, it makes the character's arms change position and rotation?

If I use Vector3, the arms just detach.

I've heard that CFraming won't make them detach, but I'm not sure how to use it.

Can someone provide a simple script that moves the arm over a few studs so I can use it as a base for the actual script? Or would that be too much of a request?

0
I believe you can use a Tool to get the body parts to pose. Marios2 360 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

You could use the animations, they're free to make. If you still don't get it, then there are Moter6Ds in the player's character. If you want to move the right arm a few studs forward then:


Like most joints, joints have C0 and C1. These mean CFrame0 and CFrame1 for part0 and part1. We need to move C1 3 studs forward, we can use lookVector so we know where is forward for the player.


CFrame

Is like Vector3 but it's more complicated, you can change angles and there is lookVector and many other thing that aren't useable with Vector3. Here are the features we will be using with CFrame:

lookVector

Will determine where the part's front face is facing.

print(workspace.Part.CFrame.lookVector) --Will print a Vector3 of where it is facing.

Angles

Angles are useful and with CFrame.Angles you can change the CFrame of the Part AND Rotate it!

workspace.Part.CFrame = CFrame.new(0,10,4) * CFrame.Angles(0,math.rad(45), math.rad(5))

Now you have to use math.rad() when changing the Angles to something, BUT you don't have to do that if you do something like this:

workspace.Part.CFrame = CFrame.new(0,10,4) * CFrame.Angles(0, 141.371669/pi, 15.7079633/pi)

I think it's like that. You don't need to do the pi way but make sure you use math.rad(). If it isn't right, I didn't learn this in school yet!


UserInputService

UserInputService is a service that seeks for any sign of input(clicking, scrolling, typing)

local uis = game:GetService("UserInputService")

uis.InputBegan:connect(function(input, chat) --Input began is like KeyDown, but not deprecated.
    if input.KeyCode == Enum.KeyCode.E and not chat then
        --Code
    end
end)


Final Product

--LocalScript
local uis = game:GetService("UserInputService")
local plyr = game:GetService("Players").LocalPlayer

plyr.CharacterAdded:connect(function(char)
    local t = char:WaitForChild("Torso")
    local motor = char:WaitForChild("Right Shoulder")
    uis.InputBegan:connect(function(input, chat)
        if input.KeyCode == Enum.KeyCode.E and not chat then
            motor.C1 = motor.C1+motor.C1.lookVector*3
        end
    end)
end)



Hope it helps!

Ad

Answer this question