Click a Button To Tween a model to a location

I want to make it so when you press a button, the model will go to the location specified.
I don’t know how to make models tween, this is my current code:
local clickDetector = script.Parent

local model = workspace.billboard
local tweens = game:GetService(“TweenService”)
local info = TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 1, true)
local pos = model.Position - Vector3.new(0,10,0)
local tween = tweens:Create(model, info, {Position = pos})
local function onClicked(player)
tween:Play()
end

clickDetector.MouseClick:Connect(onClicked)

Is there any solution to this?

You can’t tween a model.
Instead of tweeing the model you can weld all the other parts of a model to a single part, and tween that single part

OK, I’ve tested it and it works with a single part, but how do I make it stay in that pos, since it reverts back to the original pos

The reverse property on your tween is set to true, paste this script instead:

local model = workspace.billboard
local tweens = game:GetService(“TweenService”)
local info = TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false)
local pos = model.Position - Vector3.new(0,10,0)
local tween = tweens:Create(model, info, {Position = pos})
local function onClicked(player)
tween:Play()
end

clickDetector.MouseClick:Connect(onClicked)

make sure to modify the script in order to tween the single part instead of the model

Thanks! (Adding this because I need atleast 30w.)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.