I am working on a very simple pneumatic door script that requires changing the C0 of multiple Motor6D instances to achieve a desired opened/closed position for both the pistons and doors of the model. I have written some basic code for it, but unfortunately, it seems as if when the tweens play, they don’t update the positions of where the parts SHOULD be. The C0 and C1s change, though! So I’m confused - code block below.
local TweenService = game:GetService("TweenService")
local Doors = script.Parent
local function OpenDoors(plr)
for i = 1, 2 do
task.spawn(function()
local StringedNum = tostring(i)
for Piston = 4, 2, -1 do
local StringedPiston = tostring(Piston)
local Motor6D = Doors[StringedNum][StringedPiston][tostring(Piston - 1)]
Doors[StringedNum][StringedPiston].retract:Play()
local Tween = TweenService:Create(Motor6D,TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{C0 = CFrame.new(0,0,0),C1 = CFrame.new(0,0,0)})
Tween:Play()
task.wait(2.7)
Tween:Destroy()
end
local Tween = TweenService:Create(Doors["Door" .. StringedNum].main.Union,TweenInfo.new(6,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{C0 = Doors["Door" .. StringedNum]:GetAttribute("goal")})
Tween:Play()
task.wait(7)
Tween:Destroy()
end)
end
end
script.Parent.test.ClickDetector.MouseClick:Connect(OpenDoors)
I’d like to reiterate: the appropriate CFrame changes DO happen! However, they do not seem to take effect.
Furthermore, the moving parts are unanchored, and the stationary ones are anchored. This includes some parts with the Motor6D, but they’re at the top of the chain - so they SHOULD remain unaffected…
well im not quitting development but im still pulling out my hair trying to clean up roblox’s mess
havent edited in a bit, im changing how anchored parts behave. i just launched a session and realized that i didnt remove my previous code that doesnt work this is fun oh and the map appeared on the first go. i wouldnt need to veto for 12 minutes rn. but roblox doesnt like me, so now I have to go back and fix the mistake then veto for 2 years before i get the map i desire
blaming roblox for your lack of knowledge wont get you anywhere. this is a you problem, not roblox. and trust me when i say this because making doors in roblox is really easy especially nowadays that everything is on youtube
Have you tried using Motor6D.Transform? It’s a hidden property used by the engine to playback animations. It’s meant to be the part that’s updated at runtime, not the offsets. No replication so it has to be set on the client, and there’s a chance TweenService can’t see it.
So you go onto the code help forum and lambast people who… need help with their code?
I’m aware making a door open is easy. You think I’ve been lollygagging around for 2 and a half years? I know there are multiple ways to make a door open and close. But this specific method wasn’t working - when I was nigh certain it should. I’ve worked with Motor6D welds for a very long time, and to have this happen was nothing short of confusing.
Either way, problem’s been resolved. Removed the door.