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

Tweening to current position plus a value?

Asked by 5 years ago

Just a quick question. Normally when tweening I set the tween to a position. However, is there a way to tween a gui to its current position plus a value. Basically, I want a gui to just move right a little bit repeatedly as part of a leaderboard system I'm working on.

0
For that I'd use variables, make a loop that increases a variable by a certain value every few seconds or less. Then insert that variable into the Tween position. I hope I make sense :P Pojoto 329 — 5y

1 answer

Log in to vote
0
Answered by
chomboghai 2044 Moderation Voter Community Moderator
5 years ago

Just set the goal's position to the current position plus an offset.

local TweenService = game:GetService("TweenService")

local part = script.Parent
local goal = {}
goal.Position = part.Position + Vector3.new(2, 2, 2) -- how much you want to add

local tweenInfo = TweenInfo.new(1) -- your tween info
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()

Hope this helps! :)

0
Thanks. I didn't realize that x and y were divided further into scale and offset. I just set a variable to scale and added a number too it. Thanks for helping me out! tygerupercut3 68 — 5y
Ad

Answer this question