Part Tween Tutorial

Hey developers! I personally have been learning how to tween guis and parts! And some people where messaging asking for help with it so I have made this opensource tutorial.

This is just a base where you can expand of to your own project. This is not a full system made exactly for your game you still have to do a little coding but i’m here to help!

First you need to create a part make sure to anchor it and put it away from spawn, then you can name it whatever.

Then, you need to create a ScreenGui & a TextButton!

Finally create a LocalScript

--[[
    Script: Tween Animation
    Description: This script animates the camera's position using TweenService.
                 The camera moves to a target position when a button is clicked.
    Author: @Devycreates
    Date: 2024-07-07
]]

local tweenService = game:GetService("TweenService")

-- Button click event to animate the camera
script.Parent.MouseButton1Click:Connect(function()
	local cam = game.Workspace.CurrentCamera
	local set = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0)
	local target = {CFrame = workspace.[YOURPARTSNAME].CFrame} 

	-- Create the tween
	local tweenstart = tweenService:Create(cam, set, target)

	-- Play the tween
	tweenstart:Play()
end)

And you’re done! Keep adding on to the system to make your on amazing tween system!
If anybody makes a product with this please let me know I’d love to see it!

Did this work for you?
  • Yes
  • No
0 voters

Thanks for reading, also feel free to ask for help!

2 Likes

Thank you so much for the help (and dedicated post, you didn’t need to do that! :wink:), this helped a bit- however in t system that I am using (toobarplus) the OnClick feature doesn’t work, and if I remove that bit it also doesn’t work :(.

I think I have found a way around this- once again thank you so much! So kind, haha.

Oh, I think I have a way around this if yours doesn’t work!

1 Like