(SOLVED) Prison Life Style Gate System

Hello there!

I’m making a Prison right now, and this is what I am trying to make:

  1. What do you want to achieve? I want to make a Front Gate like the Prison Life one

  2. What is the issue? I tried some Roblox Studio models (Click to Open
    Sliding Door) but if I add another part to the model,
    the part doesn’t move with the main part.

  3. What solutions have you tried so far? I tried looking on YouTube, but the
    Videos only include Single-Part
    Gates/Sliding Gates

The gate should open when you click a button, have a cooldown of 5 Seconds and the gate being a model with multiple parts attached to it.

Thanks!

1 Like

Assuming whatever you are using uses tweens, make sure the extra parts attached to the part being tweened are unanchored and welded to the part being tweened.

Well, I’m not using tweens (I think, I’m goated at everything except building…), I’ll try to add a picture of the gate.

the only way to do it is with TweenService

1 Like

Technically no, but efficiently yes. They could also use a :SetPrimaryPartCFrame loop which some sliding door free models so, which they said they were looking at those, or move all of the parts individually (no clue why anyone would do this lol).

2 Likes

Well, I’m goated, could you explain please? By the way, I added a picture of how it would work as I intended.

My suggestion is to WeldConstraint the whole model and then TweenService the main part.

2 Likes

Its similar to tweening a gui object, but you would have to get the TweenService for it is not a gui object, it is a BasePart

1 Like

Okay, I get the concept, but I have NO clue whatsoever on how I would proceed on making this.

Heres a tutorial I found useful for you:

1 Like

Ok, I’ll check it out, and see if I can learn something. If not, i’ll return back crying…

Please Give solution :)) I did script for you… Just change local model = your gate model :smiley:

local TweenService = game:GetService("TweenService")
local Offset=Vector3.new(-10, 0, 0)
local TimeTakenForAnimation=5
local model= game.Workspace.ModelX

for i,v in pairs (model:GetChildren()) do 
	
	coroutine.wrap(function()
		
		local goal = {}
		goal.Position = v.Position+Offset

		local tweenInfo = TweenInfo.new(TimeTakenForAnimation)

		local tween = TweenService:Create(v, tweenInfo, goal)

		tween:Play()
		coroutine.yield()
	end)()
	
	
end


2 Likes

So if the player clicks the button, the gate will open?

Yes change

local model= "YOUR GATE MODEL"

and change

local Offset=Vector3.new(-10, 0, 0)   

X or Z depends which side you opening from and how much you want to open it…

1 Like

Alright, I’ll give it a try… Do I put the script inside the button…??.. Yes, I’m very dumb indeed…

Maybe this will help you.

1 Like

I did all of the code for you with the ClickDetector just change the variables this works :slight_smile: I tested it

local TweenService = game:GetService("TweenService")
local Offset=Vector3.new(-10, 0, 0)
local TimeTakenForAnimation=5
local model= game.Workspace.ModelX



local TweenService = game:GetService("TweenService")
local Offset=Vector3.new(-10, 0, 0)
local TimeTakenForAnimation=5
local model= game.Workspace.ModelX
local pos = model.PrimaryPart.Position

local ClickDetector = script.Parent.ClickDetector
local OpenBool = false
local active = false

ClickDetector.MouseClick:Connect(function()
	
	if OpenBool==false and active==false then
		OpenBool=true	
		active=true
		
		
		for i,v in pairs (model:GetChildren()) do 

			coroutine.wrap(function()

				local goal = {}
				goal.Position = v.Position+Offset

				local tweenInfo = TweenInfo.new(TimeTakenForAnimation)

				local tween = TweenService:Create(v, tweenInfo, goal)

				tween:Play()
				tween.Completed:Connect(function()
					model.PrimaryPart.Position = pos+Offset
					active=false
					coroutine.yield()
				end)

			end)()


		end
		
		
		
		
		
	else
		if OpenBool==true and active==false then
		OpenBool=false
		active=true
		
			
			for i,v in pairs (model:GetChildren()) do 

				coroutine.wrap(function()

					local goal = {}
					goal.Position = v.Position-Offset

					local tweenInfo = TweenInfo.new(TimeTakenForAnimation)

					local tween = TweenService:Create(v, tweenInfo, goal)

					tween:Play()
					tween.Completed:Connect(function()
						model.PrimaryPart.Position = pos
						active=false
						coroutine.yield()
					end)
					
				end)()


			end
		
		
end
	end
	
	
	
	
end)
1 Like

Awesome, I’ll give it a try! :smiley:

robloxapp-20220227-0120003.wmv (2.4 MB)

1 Like

Also I added the variables twice accident you can remove the first 4 lines

local TweenService = game:GetService("TweenService")
local Offset=Vector3.new(-10, 0, 0)
local TimeTakenForAnimation=5
local model= game.Workspace.ModelX

1 Like