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

What's wrong with my CFrame manipulation?

Asked by
SCP774 191
5 years 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 191 — 5y
0
I double checked the blankets, nothing is wrong with them SCP774 191 — 5y
0
Both of the arguments are Vector3 coordinates SCP774 191 — 5y
0
keyHole.Position.Y + (keyHole.CFrame.UpVector * 4) is where the error is. DeceptiveCaster 3761 — 5y
View all comments (2 more)
0
how am I suppose to read that ;-; greatneil80 2647 — 5y
0
Remove the Vector3.new because the CFrame already checks for the position Gameplayer365247v2 1055 — 5y

1 answer

Log in to vote
1
Answered by 5 years 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