I want to create keycard border gate with smooth open animations just like in Military Simulator, but I don’t know how to use tween service and I need help for this so please reply to me soon.
3 Likes
I usually use my own Tween function to make it easier to remember:
local T = game:GetService('TweenService')
function tween(o,t,l,s,d)
s = s or Enum.EasingStyle.Linear
d = d or Enum.EasingDirection.InOut
local i = TweenInfo.new(l,s,d)
return T:Create(o,i,t)
end
All you’d have to do is:
tween(workspace.Part,{CFrame=workspace.Part.CFrame*CFrame.new(workspace.Part.Size.X)},1):Play()
In short:
tween(instance,{propertyName=value},time)
You can tween multiple properties at once just by adding something else to the array:
{Position=somePosition,Size=someSize}
You can also use an easing style and direction, but the defaults are linear.
1 Like
Also, adding on to @MightyDantheman’s reply, don’t do this on the server or it’ll look choppy in a lot of scenarios.
Fairly seen as common sense, but it’s sometimes worth the note.
1 Like