I have Tweened models before, but for some reason my script does not work. Could you guys help?
Script inside the button (the button to open my gate)
local tweenService = game:GetService("TweenService")
local info = TweenInfo.new(5, Enum.EasingStyle.Sine)
local debounce = false
local button = script.Parent
local open = Vector3.new(229, 13, 278)
local main = script.Parent.Parent.PrisonGate.Main
local closed = main.Position
for i, v in pairs(main.Parent:GetChildren()) do
if v:IsA("BasePart") then
local weld = Instance.new("WeldConstraint")
weld.Part0 = v
weld.Part1 = main
weld.Parent = v
end
end
button.ClickDetector.MouseClick:Connect(function(player)
if not debounce then
debounce = true
if main.Position == open then
local tween = tweenService:Create(main, info, {Position = closed})
tween:Play()
else
local tween = tweenService:Create(main, info, {Position = open})
tween:Play()
end
wait(5)
debounce = false
end
end)
It tweens the main part, but the parts within the model, do not move with the main part. I have welded everything…Every part in the model is unanchored except the main part.