Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why does this cframe test animating script not work?

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)

1 comment

0

try - vector.new(0,1,0) otherwise i don't know

1 answer

✓ Accepted answer

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

2 comments

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!

0

@wookey12 yep

This discussion is preserved as it was. New answers, comments, and votes are closed.