I'm trying to move this model from one place to the place I want. This was the code I wrote and I tweaked it a little bit and i got it from the Roblox Wiki:
(Written In A LocalScript
)
local TweenService = game:GetService("TweenService") local tweenInfo = TweenInfo.new(120) local goal = {} goal.Position = Vector3.new(68.92, 2, -19.63) local tween = TweenService:Create(goal, tweenInfo, script.Parent) tween:Play()
What I wanted to do was tween a part but the duration from when it got to it's current position to the goal position would be 2 minutes. (120 seconds) I tried the code above, and it didn't move at all. What am I doing wrong??
Hey there! I'm BlackOrange here to help!
First off, unfortunately, you cannot tween
Models
. Secondly, TweenService is only forServerScripts
https://wiki.roblox.com/index.php/API:Class/TweenService
Now, if this was a ServerScript (Script)
in a Part (Not a model), then your script would work.
Though this is a very simple fix, I do suggest better variable names like this:
local TweenService = game:GetService("TweenService") local Part = script.Parent local TweenTime = TweenInfo.new(120) -- since this is the time local goal = {} goal.Position = Vector3.new(68.92, 2, -19.63) local CreateTween = TweenService:Create(Part, TweenTime, goal) CreateTween:Play()
Whiling I was typing that I noticed you got 2 arguments wrong, the Object comes first in this case Part
, then TweenTime then goal. Try this new script I have made and make sure it's a Script
. Also make sure the part isn't already in the position 68.92,2,-19.63 or you won't see anything happenings.
Hopefully this helped! Best of luck!