Exgg_o
(egg)
July 23, 2020, 4:50am
#1
Essentially, I’m trying to make a sort of vault door with a spinning handle. I’m currently trying to find an effective way of doing that. This is the script I’ve come up with so far:
script.Parent.Part2.ClickDetector.MouseClick:Connect(function()
t1:Play()
wait(1)
script.Parent.Part2.WeldConstraint.Enabled = true
script.Parent.Part2.Anchored = false
wait(1)
t2:Play()
end)
That causes this
As you can probably tell, not my intention. Any help’s appreciated. Thanks!
MatkoRBX
(Matko)
July 23, 2020, 5:09am
#2
Hey there!
Could you send your tweens as well? I’d like to take a look.
Exgg_o
(egg)
July 23, 2020, 5:10am
#3
Sure.
local ti = TweenInfo.new(1)
local t1 = ts:Create(script.Parent.Part2, ti, {CFrame = script.Parent.Part2.CFrame * CFrame.new(-5, 0, 0)})
local t2 = ts:Create(script.Parent.Part1, ti, {CFrame = script.Parent.Part1.CFrame * CFrame.new(-5, 0, 0)})
MatkoRBX
(Matko)
July 23, 2020, 5:13am
#4
Okay, is there a specific reason why you’re un-anchoring your Part2?
script.Parent.Part2.Anchored = false
Exgg_o
(egg)
July 23, 2020, 5:15am
#5
Yeah, I welded Part2 to Part1, so once it’s unanchored it would move with it.
MatkoRBX
(Matko)
July 23, 2020, 5:17am
#6
Alright.
I think your issue is with you tweening Part2
while Part1
is anchored.
Exgg_o
(egg)
July 23, 2020, 5:21am
#7
I did some more research. It seems that Part2 returns to its original position before Part1 starts tweening. I unanchored Part1 to no avail.
MatkoRBX
(Matko)
July 23, 2020, 5:24am
#8
(Nevermind what I said before)
So, your parts are still welded, and both are unanchored, correct?
Exgg_o
(egg)
July 23, 2020, 5:25am
#9
I found a solution! Thanks for your help though, I appreciate it.
MatkoRBX
(Matko)
July 23, 2020, 5:26am
#10
Oh, well done! Sorry I wasn’t much of a help.