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

why does this cframe test animating script not work?

Asked by
wookey12 174
6 years ago

i made a tool, and right now i am testing cframe animations, so i made a simple one, that just changes the y axis of the right arm.

local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
 local mouse = player:GetMouse()
tool.Equipped:connect(function(mouse)
    print("Tool equipped!")
    player.Character["Right Arm"].CFrame = player.Character["Right Arm"].CFrame - CFrame.new(0,1,0)


for some reason i get the error: 23:25:37.856 - Players.wookey12.Backpack.m4a2.LocalScript:6: bad argument #2 to '?' (Vector3 expected, got CFrame)

0
try - vector.new(0,1,0) otherwise i don't know abnotaddable 920 — 6y

1 answer

Log in to vote
0
Answered by
DanzLua 2879 Moderation Voter Community Moderator
6 years ago

Here's the thing you can't subtract a CFrame from a CFrame, you can subtract a Vector3 from a CFrame but i'm guessing you want to move it on the Y axis relative to the part so what you can do is multiply the CFrame by another CFrame with what you want to move.

local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
 local mouse = player:GetMouse()
tool.Equipped:connect(function(mouse)
    print("Tool equipped!")
    player.Character["Right Arm"].CFrame = player.Character["Right Arm"].CFrame * CFrame.new(0,1,0)
--notice how I'm multiplying the CFrame
0
thanks, so you are saying, if i want to move it down, just multiply it and make it a negative number? idk why i never thought of that xD anyways thanks! wookey12 174 — 6y
0
@wookey12 yep DanzLua 2879 — 6y
Ad

Answer this question