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

TweenPosition not working on gui cinematic bar?

Heyo, i'm back with another question.. So i have like a cinematic bar and i want it to move up when u click a button (the cinematic bar is not allowed to go back btw) I'm new to tweening so i dont understand much of it.

Here is the script any improvements or tips are welcome! Thank you for reading.

local text = script.Parent.TextButton
local size = 50
local blur = game.Lighting.Blur
local credits = script.Parent.credits
local birthday = script.Parent.birthday
local CutBlur = game.Lighting.CutBlur
local camera = game.Workspace.CurrentCamera
local bar1 = game.StarterGui.ScreenGui.bar1
local bar2 = game.StarterGui.ScreenGui.bar2


text.MouseButton1Click:Connect(function()
	game.Players.LocalPlayer:WaitForChild("PlayerGui").TPGUI.Enabled = false 
	--For going down 
for i = 1, 10, -1 do 
    blur.Size = i 
    wait(.1) 
end
	blur.Enabled = false
	camera.CameraType = Enum.CameraType.Custom	
	
	bar1:TweenPosition(UDim2.new(0, 0,0, 0),"In", "Quad",1)

	bar1:TweenPosition(UDim2.new(0, 0,0.999, 0)
	
	)

print("Menu succefull, thanks to some amazing people")
end)

(this is not the full script but only the tweening part and the locals)

2 answers

So basically, what you did wrong is you didn't add tween info on bar1's second tween position. You must define the direction, duration, style, and time like you did in the one above.

2 comments

0

Ye sorry the second line was supposed to be "bar2" but i still dont really get it, is it possible u could explain it in a script?

0

you dont need tweeninfo for TweenPosition

For more information on TweenPosition I would check out the TweenPosition Wiki.

A basic example of TweenPosition for your implementation is:

guiObject:TweenPosition(
	UDim2.new(1, 0, 1, 0),   -- Final position the tween should reach
	Enum.EasingDirection.In, -- Direction of the easing
	Enum.EasingStyle.Sine,   -- Kind of easing to apply
	2,                       -- Duration of the tween in seconds
	true                     -- Whether in-progress tweens are interrupted
)

I do not take credit this example is on the wiki

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