I need Help with tweenservice

I don’t know how to use tweenservice so i created this topic to try at least get some help
Please don’t ask me to make everything for you
i just need help so i would like it if you would help me because I’m fairly new to using luau to script

Plenty of good information on the Doc site:

TweenService | Documentation - Roblox Creator Hub

UI Animations | Documentation - Roblox Creator Hub

Here’s a code sample:

local TweenService = game:GetService("TweenService")
local Tweeninfo = TweenInfo.new(
--number of seconds it takes,
Enum.EasingSyle.Sine --this will slow it down by the end, the official documentation shows you each one of the easing styles
Enum.EasingDirection.Out --in goes backwards, inout goes backwards and then back
--theres a few more Params but i forgot, but one of them was how many times it repeats, default is 0 and you don't need the last ones.
)
local Goal = {Property = --like Color = Color3.fromRGB(), it needs to be in curly brackets.}
local CreatedTween = TweenService:Create(path to object, Tweeninfo, Goal)
CreatedTween:Play()
1 Like

Whenever you want to learn something, whether scripting or something unrelated to Roblox, research is essential first. The internet contains so much information on literally anything you need, as @dduck5tar mentioned there are lots of documentation about the Tween service.

Programmers always research things, even stuff that they’ve done hundreds of times before. We always forget things and get errors. Scripting isn’t just memorising methods and syntax. It’s like 90% reading documentation and research, also many many nights without sleeping realising you made a typo :sweat_smile:.

Anyway, as others have mentioned, you should check out the TweenService Documention.

I recommend trying to do things yourself before going on the dev forum to post them. It’s important to be able to do things independently.

Good luck on your scripting journey! It won’t be easy

2 Likes

To anyone saying to look at documentation, while you should do that, if you don’t understand something you cannot ask questions, and the documentation feels very criptic to a learner since it uses weird words. It’s way easier to ask somebody and you can have as many questions as you need.
I’m not saying anyone said that you shouldn’t ask, i just gave a perspective. It’s good to look at documentation.

2 Likes

I never said don’t ask questions on the forums, I said how in the future documentation will be essential if you are planning on scripting a lot. The dev forum is great as you get support from real people, instead of figuring it out alone. However, it is important to be able to do things alone.

Blockquote It’s way easier to ask somebody and you can have as many questions as you need.

Of course, it’s easier to get other experienced people to do things for you on the forums, but you can’t be creating posts for every single error/thing you don’t understand right? It takes time and effort for everything.

Sorry if either one of you read my post wrong. I did not mean this in any negative way and did not mean to say “stop posting on the devforum”. I’m only trying to welcome and be supportive of new players.

I know you didn’t mean that, i wasn’t clear in my post. Edited it.

1 Like

So like do i have 2 objects?
For example if i made a door which uses tweens to operate do i need an open and closed part to tween between them with?
an open position and closed position which are all invisible?

Then i use a script to create the animation and activate it so it moves?

no. i don’t quite get what you don’t understand but you could have 1 door and have 2 tweens, an opening one and a closing one.

Alright i got the tweenservice in, the tween information, now what do i need in the goal?

1 Like

a property, like color transparency, cframe/position etc

Just position I’m not interested in color

{Position = Vector3.new(coordinates)}
Or
{CFrame = CFrame.new(coordinates)}
Or even
{CFrame = (path to part).CFrame * Vector3.new(let’s say you wanna add to the y axis. Then you’d do 0,5,0)}
I recommend you use CFrame. Even though vectors and cframes are similar cframes are better. Also the last one is adding to the position. Yes you need multiplication to convert the vector to cframe but it works like addition, so the last example adds 5 to the Y axis.

But the advantage of using tween is how i can set a style of movement
CFrame doesn’t support that but I’ll try again with tweening but I’ll switch to CFrame if it doesn’t work

1 Like

Can you show me your code?

It’d greatly help and i can help you easier.

alr here it is.
local TweenFunction = game:GetService(“TweenService”)

local TweenOpenActivator = script.Parent.Parent.Parent:WaitForChild(“OpenCMD”)

local Open = script.Parent.OpenMesh

local TweenGoal = script.Parent.OpenMesh.Position

local TweenInformation = TweenInfo.new(Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)

local TweenCreation = TweenFunction:Create(Open, TweenInformation {TweenGoal})

local IsOpen = false

TweenOpenActivator.Event:Connect(function()

script.beep:Play()

if IsOpen == false then

TweenCreation:Play()

wait(0.2)

IsOpen = true

else

print(“Error. Door is open already.”)

end

end)

what’s .Event?
rawblacksrfwedsz

no we’re on the topic of tween service.

??? literally asked about a section of your code??