So basically I have been looking around trying to make a door that will open and close with an animation, like the ones in Jailbreak and I can't find out how to do so. I would greatly appreciate it if someone could help me.
Alright so I'll cover each form of movement that can be performed.
The following is an example script
local TweenService = game:GetService("TweenService") local timer = 5 local tweenInfo = TweenInfo.new(timer) function MoveIt() local goal = {} goal.CFrame = CFrame.new(100, 2.5, 100) -- Target Position local part = workspace.TweenMod.Part local tween = TweenService:Create(part, tweenInfo, goal) tween:Play() wait(timer) end script.Parent.TextButton.Activated:Connect(MoveIt)
The CFrame may also be replaced with Position if you don't need rotation to occur. Although tedious, you could also have each part in a model play a tween at the same time, as long as they are pre-defined.
tween1:Play() tween2:Play() wait(timer)
The following is an example script
repeat script.Parent:SetPrimaryPartCFrame(script.Parent.Part.CFrame + Vector3.new(0, 0, 0.1)) -- increment to move wait() until script.Parent.Part.CFrame == CFrame.new(0, 0, 0) -- When to end the movement
The following is an example script for playing the animation
local animation = script.Parent local animPlayer = workspace.Model.Humanoid:LoadAnimation(animation) repeat animPlayer:Play() wait(2) -- or however long the animation is set to last for until script.Parent.TurnOff.Value == false
Closed as Not Constructive by LeadRDRK, zblox164, WideSteal321, starmaq, DinozCreates, SteamG00B, SerpentineKing, EpicMetatableMoment, and Azmidium
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?