I have a made a sliding door using tweenservice, which works fine,
-- part of server script(remote)
local d1x=d1.Position.X
local d1y=d1.Position.Y
local d1z=d1.Position.Z
local d2x=d2.Position.X
local d2y=d1.Position.Y
local d2z=d2.Position.Z
local newpos1=d1x+2.8
local newpos2=d2x-2.8
root=d1
root2=d2
local d1open = {Position = Vector3.new(newpos1, d1y, d1z)}
local d1close = {Position = Vector3.new(d1x, d1y, d1z)}
local d2open = {Position = Vector3.new(newpos2, d2y, d2z)}
local d2close = {Position = Vector3.new(d2x, d2y, d2z)}
local sound=doors.soundpart.Sound
local grant=doors.soundpart.grant
local deny=doors.soundpart.deny
print(d1open)
I want to replicate this for multiple doors (I am not currently concerned about the fact that they'll only move on the x axis), without having to reference a separate model each time,
-- local script
local repStorage=game:GetService("ReplicatedStorage")
local remote1=repStorage:WaitForChild("Remote1")
local remote2=repStorage:WaitForChild("deny")
local player=game.Players.LocalPlayer
local mouse=player:GetMouse()
local doors=game.Workspace:WaitForChild("doors") -- this is the model for the current door(s)
button=doors.button.ClickDetector
butt=button.Parent
button.MouseHoverEnter:Connect(function()
button.Parent.SelectionBox.Visible=true
button.Parent.pressgui.Enabled=true
end)
button.MouseHoverLeave:Connect(function()
button.Parent.SelectionBox.Visible=false
button.Parent.pressgui.Enabled=false
end)
local db2=true
local db = false
mouse.Move:Connect(function()
print(mouse.Target)
mouse.KeyDown:Connect(function(key)
if key=='f' then
if mouse.Target==butt then
if not db then
remote1:FireServer()
wait()
db = true
wait(5)
db=false
elseif db and db2 then
db2=false
remote2:FireServer()
wait(1.5)
db2=true
end
end
end
end)
end)
Is there any way that I could somehow either find the parent of a clickdetector that was activated, or anything similar that would not make me have to make separate variables for each model etc. Sorry if I have confused you, please feel free to leave a comment and I'll try to explain it the best I can. Thanks.

2 comments
Still not sure how I'd do this, or what this would even do, get the children of all the models named 'doors', the single model? Would I put my whole code into this etc?
edited