I tried making a script using BodyPostion which selects all the parts of a door and moves them to a different position to make it a sliding door. However, when it tries setting the BodyPostion it doesn't work and nothing happens.
local door = script.Parent.Parent.Model:GetChildren() script.Parent.ClickDetector.MouseClick:Connect(function(Onclick) for _,part in pairs(door) do local yPosition = part.Position.Y local zPosition = part.Position.Z part.CanCollide = false part.BodyPosition.Position = Vector3.new(-24.325,yPosition,zPosition) end end)
For stuff like a sliding door it is best to use TweenService.
local TweenService = game:GetService("TweenService") local door = script.Parent.Parent.Model:GetChildren() local TweeningInformation = TweenInfo.new(3) --door will be opening for 3 seconds script.Parent.ClickDetector.MouseClick:Connect(function(Onclick) for _,part in pairs(door) do local yPosition = part.Position.Y local zPosition = part.Position.Z local target = {Position = Vector3.new(-24.325,yPosition,zPosition)} part.CanCollide = false local tween = TweenService:Create(part,TweeningInformation,target) tween:Play() end end)