Player = game.Players.LocalPlayer
Character = Player.Character
Mouse = Player:GetMouse()
LeftShoulder = Character.Torso["Left Shoulder"]
RightShoulder = Character.Torso["Right Shoulder"]
LeftHip = Character.Torso["Left Hip"]
RightHip = Character.Torso["Right Hip"]
function LeftPunch(key)
Key = key:lower()
if Key == "q" then
for i = 1, 1 do
for i = 1, 10 do
LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, -0.25)
Character.Torso.CFrame = CFrame.fromEulerAnglesXYZ(0,0,0)
wait()
end
for i = 1, 10 do
LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, 0.25)
wait()
end
end
end
end
function RightPunch()
end
function LeftKick()
end
function RightKick()
end
Mouse.KeyDown:connect(LeftPunch)
--I just want this to make me rotate to the right when I press q but formeulerangles doesnt do that what am I doing wrong?
COMMUNITY QUESTION
How Do I make this rotate my entire body?
2 answers
Your character isn't created by the time the script starts running, so you have to wait for the character.
Player = game.Players.LocalPlayer
Character = Player.CharacterAdded:wait() -- I'm using the CharacterAdded function here to pause the script until the character is added.
print(Player.Character.Name) -- This should print your character's name, just to make sure the character is loaded.
Mouse = Player:GetMouse()
LeftShoulder = Character.Torso["Left Shoulder"]
RightShoulder = Character.Torso["Right Shoulder"]
LeftHip = Character.Torso["Left Hip"]
RightHip = Character.Torso["Right Hip"]
function LeftPunch(key)
Key = key:lower()
if Key == "q" then
for i = 1, 1 do
for i = 1, 10 do
LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, -0.25)
Character.Torso.CFrame = CFrame.fromEulerAnglesXYZ(0,0,0)
wait()
end
for i = 1, 10 do
LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, 0.25)
wait()
end
end
end
end
function RightPunch()
end
function LeftKick()
end
function RightKick()
end
Mouse.KeyDown:connect(LeftPunch)
Now, try your script. If that doesn't solve your problem, please come back and maybe we can help.
Inside the HumanoidRootPart, there is a Motor6D called RootJoint. So what I would do is: ~~~~~~~~~~~~~~~~~ local rootJoint = Character.HumanoidRootPart:WaitForChild("RootJoint") rootJoint.C0 = rootJoint.C0 * CFrame.Angles(0, -30, 0) -- rotate -30 degrees
Hope this helps!
This discussion is preserved as it was. New answers, comments, and votes are closed.
