Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Tweening to current position plus a value?

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.

1 comment

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

1 answer

✓ Accepted answer

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! :)

1 comment

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.