Hello! I’m trying to make a gate that does whats shown below. How can I do this with tweening service? Thanks!
Hi! You just have to create 2 tweens and play them.
local tw = game:GetService("TweenService")
local gate1 = "define your part here"
local gate2 = "define your part here"
local a = tw:Create(gate1, TweenInfo.new(arguments here), {Position += Vector3.new(0,0,10) or on whatever axis it is})
local b = tw:Create(gate2, TweenInfo.new(arguments here), {Position += Vector3.new(0,0,-10) or on whatever axis it is})
a:Play()
b:Play()
Hope it helps!
You could use the primarypart of each gate model as a pivot, and rotate it accordingly to 90 degrees.
You’re welcome to use TweenService, but be cautious with it because it’s affected by lag.
If you want a smoother gate, you can simply use constraints (HingeConstraint would likely work). Plus, it’s most likely easier than TweenService.
If you don’t want constraints, then the post above is your solution.
Sorry if I’m being annoying, yet what do I put for “arguments here”? I don’t use tweenservice alot
These are the parameters/arguments for tweenservice. You need to create a TweenInfo.new() as the 2nd parameter and i’m sure roblox studio should guide you from there since it shows what else you can add to your tweeninfo.
(obj, tweeninfo, {properties of the obj})
I was just showing him how tweenservice would work, but yeah it’s more of just a secondary explanation.
My bad, I thought you said “Those” instead of “These”. The difference that just one letter can make!
Hey! I ended up changing it a bit. Was wondering how I can make it rotate at one end of it instead of the middle. Thanks!
Code:
local tw = game:GetService("TweenService")
local gate1 = game.Workspace.Door1
local gate2 = game.Workspace.Door2
local goal = {}
goal.Orientation = Vector3.new(0,90,0)
local tweenInfo = TweenInfo.new(5)
local a = tw:Create(gate1, TweenInfo.new(10, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0), goal)
local b = tw:Create(gate2, TweenInfo.new(10, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0), goal)
wait(20)
a:Play()
b:Play()
You mean like a door? That’s pretty easy.
First off you’ll need a door or just a simple part and another one to act like a hinge.
Example:
The blue highlighted part is the hinge and the orange is the actual door.
Then what you’ll have to do is unanchor the door, anchor the hinge and attach the door to the hinge using a weldconstraint
Part0 is gonna be the frame and Part1 the Hinge
After that just rotate the hinge instead of the door and it should also rotate the door. You can also make the hinge’s Transparency to 1 so you can’t see it.
Hope it helped and I also hope that you understood everything. If not, you can always reply and I’ll respond as soon as I can!
Im looking to do this for 2 gates. Where it opens (2 sides open synchronized the same way), and then in 20 seconds it closes. these 2 need to be connected, but some reason they arent open connected.
Thanks!
No problem! Just make a hinge for every one of them and then script them to rotate in the opposite direction and bam
not sure whats up. some reason only 1 is moving. i have 2 hinges, etc
You have to rotate both of the hinges and with 2 different tweens (opposite directions)
I did this, but now the gate isn’t moving with the hinge now. No idea why. The weld is fine, etc.
It doesn’t move when you move it in studio, but if you move it in a script with a tween it should work!