Hey, i am getting problems with my script, i wanna add position in a tween, but i get marked it as an error?
3 Likes
- You have an extra parenthesis.
- You’ll need to use a
Vector3
. You can write it as{Position = revRedNew.Position + Vector3.new(100, 100, 100)}
or{Position = revRedNew.Position + Vector3.one * 100}
.
2 Likes
That line would be:
local tween = ts:Create(revRedNew, info, {Position = revRedNew.Position.Z+100})
3 Likes
i got this error:
“attempt to perform arithmetic (add) on number and Vector3”
2 Likes
Would you mind showing the new code you’re using?
2 Likes
I’m assuming you want the part to go 100 studs forward in the Z direction. In that case, use this. (assuming ‘revRednew’ is a object).
local tween = ts:Create(revRedNew, info, {CFrame = revRedNew.CFrame * CFrame.new(0,0,-100)})
3 Likes
Property Position
expects Vector3
, but you’re passing a number
, which is the Z axis with 100 added to it.
local oldPos = revRedNew.Position
local newPos = Vector3.new(oldPos.X, oldPos.Y, oldPos.Z + 100)
local tween = ts:Create(revRedNew, info, { Position = newPos })
2 Likes
Yeah my bad, it would actually be:
local tween = ts:Create(revRedNew, info, {Position = Vector3.new(revRedNew.Position.X, revRedNew.Position.Y, revRedNew.Position.Z+100})
4 Likes
I don’t understand why people cant give a solution…
local tween = ts:Create(revRedNew, info, {Position = revRedNew.Position + Vector3.new(0, 0, 100)})
(my bad rcw basically solved it)
2 Likes
Yeah my function and dauser’s function do the exact same thing in two different ways
1 Like