Player = game.Players.LocalPlayer Character = Player.Character Mouse = Player:GetMouse() run = game:GetService('RunService') RS = Character.Torso["Right Shoulder"] enabled = true function onkey(key) if key == "r" and enabled == true then for i = 1, 10 do RS.C0 = RS.C0*CFrame.fromEulerAnglesXYZ(0, 0, 0.16) enabled = false end Hand = Instance.new("Part", Character) Hand.FormFactor = "Custom" Hand.CanCollide = true Hand.Size = Vector3.new(0.2, 2.57, 0.42) Hand.BrickColor = BrickColor.new("Black") Hand.CFrame = Character.Torso.CFrame*CFrame.new(0, 4, 4) Hand.CFrame = CFrame.fromEulerAnglesXYZ(0, 1.5, 0) Weld = Instance.new("Weld",Character) Weld.Part0 = Weld.Parent["Right Arm"] Weld.Part1 = Hand Weld.C1 = CFrame.fromEulerAnglesXYZ(0, 0, 0) *CFrame.new(0 , 1.5 , 0) end end function Slash() for i =1, 12 do RS = Character.Torso["Right Shoulder"] RS.C0 = RS.C0 *CFrame.fromEulerAnglesXYZ(0, 0, 0.16) run.Stepped:wait() end for i =1, 12 do RS = Character.Torso["Right Shoulder"] RS.C0 = RS.C0 *CFrame.fromEulerAnglesXYZ(0, 0, -0.16) run.Stepped:wait() end end Mouse.Button1Down:connect(Slash) Mouse.KeyDown:connect(onkey)
I'm trying to make a sword...
However, I do not come very far due to me being newbeginner in Lua and don't know to rotate it? I know CFrame.Angles works but it didnt for me..
local Player = game.Players.LocalPlayer local Character = Player.Character local Mouse = Player:GetMouse() local run = game:GetService('RunService') local RS = Character.Torso["Right Shoulder"] enabled = true function onkey(key) if key == "r" and enabled == true then for i = 1, 10 do local RS.C0 = RS.C0*CFrame.fromEulerAnglesXYZ(0, 0, 0.16) enabled = false end Hand = Instance.new("Part", Character) Hand.FormFactor = "Custom" Hand.CanCollide = true Hand.Size = Vector3.new(0.2, 2.57, 0.42) Hand.BrickColor = BrickColor.new("Black") Hand.CFrame = Character.Torso.CFrame*CFrame.new(0, 4, 4) Hand.CFrame = CFrame.fromEulerAnglesXYZ(0, 1.5, 0) Weld = Instance.new("Weld",Character) Weld.Part0 = Weld.Parent["Right Arm"] Weld.Part1 = Hand Weld.C1 = CFrame.fromEulerAnglesXYZ(0, 0, 0) *CFrame.new(0 , 1.5 , 0) for i = 1, 2 do for i = 1, 12 do Hand.C0 = Hand.C0 *CFrame.Angles(0, 0, -0.16) Hand.C0 = Hand.C0 *CFrame.Angles(0, 0, 0.16) Hand.C0 = Hand.C0 *CFrame.Angles(0, 0.1, 0) Hand.C0 = Hand.C0 *CFrame.Angles(0, -0.1, 0) Run.Stepped:wait(0.01) end for i = 1, 12 do Hand.C0 = Hand.C0 *CFrame.Angles(0, 0.1, 0) Hand.C0 = Hand.C0 *CFrame.Angles(0, -0.1, 0) Hand.C0 = Hand.C0 *CFrame.Angles(0, 0, 0.16) Hand.C0 = Hand.C0 *CFrame.Angles(0, 0, -0.16) Run.Stepped:wait(0.005) end end for i = 1, 12 do Hand.C0 = Hand.C0 *CFrame.Angles(0, 0, -0.16) Hand.C0 = Hand.C0 *CFrame.Angles(0, 0, 0.16) Hand.C0 = Hand.C0 *CFrame.Angles(0, 0.1, 0) Handr.C0 = Hand.C0 *CFrame.Angles(0, -0.1, 0) Run.Stepped:wait(0.005) end end function Slash() for i =1, 12 do RS = Character.Torso["Right Shoulder"] RS.C0 = RS.C0 *CFrame.fromEulerAnglesXYZ(0, 0, 0.16) run.Stepped:wait() end for i =1, 12 do RS = Character.Torso["Right Shoulder"] RS.C0 = RS.C0 *CFrame.fromEulerAnglesXYZ(0, 0, -0.16) run.Stepped:wait() end end Mouse.Button1Down:connect(Slash) Mouse.KeyDown:connect(onkey)
what i put in the Frames you can put any number if you know what a Cframe is but feel free to ask ( this is not going to rotate it it is just a example of numbers you can put to rotate)