TweenService V2

Are there examples of the server and client code required to use?

Regards

This tutorial that @SteadyOn uploaded should do the trick. TweenService V2 | Roblox Scripting Tutorial šŸ“œšŸ“œ - YouTube

Iā€™m not exactly sure if this is possible, as the way this module was coded was that the actual tweening was done on the client as opposed to the server. You could hard-code something similar to it and check if the duration of the tween has passed since it started to check if it is done. For :Cancel() and other stuff you could hard-code that.

1 Like

Is this meant to be used so " :GetTweenObject()" can only be called in the server and not in the client?

The line

latestFinish[instance] = latestFinish[instance] or os.time() -- cannot be nil.

will error nil I believe because of streaming enabled.

Hi,

The TwwenService works well for me but would like to see a way for getting the part to face the way of the tween as an option?

ReplicatedTweening.rbxl (38.2 KB)

This Module is very useful and makes Tween Replication a breeze. I noticed several people having issues making use of this module due to various errors. Here is a place file with a basic working example.

3 Likes

Good day,

how would you set the tween to repeat?

Regards

This is awesome! Thanks, Iā€™ll add this to the original post

1 Like

Has anyone tried to to use this for a Zombie type game with some custom NPCs? I wonder how efficient this module would remain if you recalculated path finding every 1 second for the zombies?

Hey @SteadyOn!
I believe I found a bug/error:
Stop is not a valid member of Tween "Tween"
In the script: (line 217)

As far as I know, :Stop() isnā€™t a function in tweenService. Should this be replaced with :Cancel()?

Other than that, very thankful for you sharing this great module with us!

Edit:
I tried changing :Stop() with :Cancel() and it somewhat works. However, since the module interprets it as the animation finishing it automatically re-assigns the parts position to itā€™s pre-defined end position.

As in: I cancel the animation, and then it automatically (On the server, and hence, all clients) teleports to itā€™s end position INSTEAD of staying where it was cancelled.

Is there any thing I am doing wrong? Or is there any way to let the part stay when cancelled, and NOT be teleported to the end position that was defined in the tweenInfo? PS: This is when changing the :Stop() to :Cancel()

Thanks!

Do you have plans of trying to create a function like TweenService:TweenModel()? Iā€™m having a hard time tweeting models and keeping all of the same axis.

Iā€™ve tried for _, item in pairs(Item.Door1:GetChildren() do and it keeps on moving all of the axis and not just the 1 I want.

Someone else here already made it!

Just set any part of the model as a PrimaryPart (preferably part at center) and then tween itā€™s CFrame.

TweenService:Create(Model.PrimaryPart, TweenInfo.new(2), {CFrame = CFrame.new(Vector3.new(0, 20, 0))})

PrimaryPart is a property of Model btw

Is there any way to find when a tween ends using this module?

Hmm this is weird, maybe it was added in one of the commits I approved, will try to check it out when I have the time!

1 Like

Thank you! I appreciate you taking the time to fix this. While youā€™re at it, I found another bug (I believe):

So the problem is that I keep getting the error Tween being paused does not exist. when trying to pause tweens using remote events.

Doing:

tween:Play()
wait(2)
tween:Pause()

works great, but when I do something like this:

startEvent.OnServerEvent:Connect(function()
	tween:Play()
end)

pauseEvent.OnServerEvent:Connect(function()
	print("Pausing tween!")
	tween:Pause() 
end)

It starts the tween, when trying to stop it, I get the error: Tween being paused does not exist.

I am not sure why this happens, Iā€™ve looked at the code and tried to debug some. But it seems like the tween for some reason doesnā€™t get saved in the module (also in earlier lines than when the warning is printed).

By the way, for some reason it works if both :Pause() and :Play() is in the same event:

startEvent.OnServerEvent:Connect(function()

tween:Play()

wait(2)

tween:Pause()

end)

Iā€™ve talked with some other users who use this module, and they have the same issue. It would be nice if you could take a look at that also, since it working with remote events is quite important for many!

Thanks again!

Would you mind DMing me the whole script? Or just the relevant parts if itā€™s huge. Just want to figure out whether this is a module issue or a use case I didnā€™t consider.

1 Like

Iā€™ll be able to send it tomorrow, first thing. I currently donā€™t have access to my PC. Thanks for taking a look at it! :slight_smile:

Edit: Iā€™ve sent you a PM!

Hi, sorry for bumping this topic. But did you receive my DM?

Yeah that can be usefull, you think to add it?