New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

What's wrong with my CFrame manipulation?

Asked by
SCP774 176
7 months ago

I'm making an unique crate unboxing system where crates will fall from the sky like an airdrop. I'm currently stuck at tweening the camera to focus at the key hole that's on the crate.

local tweenAnim = tweenService:Create(crateMain, tweenInfo, {Position = CFrame.new(Vector3.new(keyHole.Position.X + (keyHole.Size.X * 1.5), keyHole.Position.Y + (keyHole.CFrame.UpVector * 4), keyHole.Position.Z), Vector3.new(keyHole.Position.X, keyHole.Position.Y, keyHole.Position.Z))})

Here's the error.

20:52:38.751 - ReplicatedStorage.CrateSystem:312: bad argument #1 to '?' (Vector3 expected, got number) 20:52:38.752 - Stack Begin 20:52:38.752 - Script 'ReplicatedStorage.CrateSystem', Line 312 20:52:38.752 - Stack End

I'm pretty sure that only the CFrame part errors.

CFrame.new(Vector3.new(keyHole.Position.X + (keyHole.Size.X * 1.5), keyHole.Position.Y + (keyHole.CFrame.UpVector * 4), keyHole.Position.Z), Vector3.new(keyHole.Position.X, keyHole.Position.Y, keyHole.Position.Z))

Any idea on how to fix it? Thanks.

0
It only has 2 arguments, the coordinated to tween to and the coordinate to point at SCP774 176 — 7mo
0
I double checked the blankets, nothing is wrong with them SCP774 176 — 7mo
0
Both of the arguments are Vector3 coordinates SCP774 176 — 7mo
0
keyHole.Position.Y + (keyHole.CFrame.UpVector * 4) is where the error is. BashCaster 2372 — 7mo
View all comments (2 more)
0
how am I suppose to read that ;-; greatneil80 1439 — 7mo
0
Remove the Vector3.new because the CFrame already checks for the position Gameplayer365247v2 727 — 7mo

1 answer

Log in to vote
1
Answered by 6 months ago
local tweenAnim = tweenService:Create(crateMain, tweenInfo, {CFrame = CFrame.new(keyHole.Position.X + (keyHole.Size.X * 1.5), keyHole.Position.Y + (keyHole.CFrame.UpVector * 4), (keyHole.Position.Z), (keyHole.Position.X), (keyHole.Position.Y), (keyHole.Position.Z)
Ad

Answer this question