Tweening Problem

I am trying to make a system where I tween a lever down. I know how to tween, and well at that. The problem is that I want to be able to copy this script over and over with out having to change the position value for each one.

The issue is everything I try like "Position -= Vector3.new(0, 2-2, 0) just gets an error

I will provide the code I have tried. Keep in mind this code gets errors.

local serv = game:GetService("TweenService")
local info = TweenInfo.new(.5, Enum.EasingStyle.Back, Enum.EasingDirection.Out, 0, false, 0)
local pos = script.Parent.Parent.Position - Vector3.new(0, 2.2, 0) -- getting error here
local tween = serv:Create(script.Parent.Parent, info, pos)

script.Parent.Triggered:Connect(function()
	tween:Play()
end)

The output looks like this:
image

and in case you wanted to know the lever looks like this:

1 Like
local tween = serv:Create(script.Parent.Parent, info, {Position = pos})

1 Like

Thank you, this works! How come it doesn’t work without the "Position = ", though? I stated this in the variable.

`local pos = script.Parent.Parent.Position - Vector3.new(0, 2.2, 0)’

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.