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.
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)