#door system

1 messages · Page 1 of 1 (latest)

low topaz
#

yes again and again, i have made some models named: Pop and Open, which are preset models, and the script gets the positon of it, but GUESS WHAT, NOTHING CHANGED ITS LIKE I NEVER CHANGED THE SCRIPT, its still ffing offseting for whatever gods green earths, and ontop of that ITS WELDED:

#

and still same: Servo target angle to 0 scenario

fierce wing
#

Send the script trough """script"""

#

Or sum like that

#

So people don't have to download it

#

It raises the chance of help

low topaz
#

you can js read it through discord

fierce wing
#

I cant even read it

#

I cant even read it

#

Mobile rn

low topaz
#

skill issue

#

all scripters are pc

fierce wing
#

I am

#

On vaca

#

🥀

low topaz
#

all scripters are on pc

fierce wing
#

I am

low topaz
#

you on what

fierce wing
#

I jist dont have acces to my pc rn

low topaz
#

but you can still read it through discord

#

same as video

fierce wing
#

Its just extta effort on my part

#

An no

low topaz
#

its downloading and opening it

fierce wing
#

I need to select it

low topaz
#

select what

fierce wing
#

Yh

low topaz
#

i tried to paste it and

#

"Get nitro"

fierce wing
#

Okay

#

Well then it's not ur fault

low topaz
#

im tryna solve the problem of these weird "offsets"

fierce wing
#

Try screenshotting it

low topaz
#

k

low topaz
fierce wing
#

I meant the script ;-;

#

So ypu dont have to send txt file

low topaz
#

js download it

#

its not rocket science

fierce wing
#

I dont wanna tho

low topaz
#

is really long

fierce wing
#

Its so much effort

#

Alr wait

#

Does ot give an error?

low topaz
#

no

fierce wing
#

Are you using tweens?

low topaz
#

yes

fierce wing
#

Oh waot

#

The ss says enough

low topaz
#

here:

fierce wing
#

Youre applying the same animation for both doors (it looks loke ot) but you have to make some values negative or positive

low topaz
#

nope

#

its preset parts

#

half of script: local TweenService = game:GetService("TweenService")

local POP_TIME = 1.5
local SLIDE_TIME = 2.5
local WAIT_BEFORE_DOORS = 1
local TWEEN_DELAY = 1.5
local HOLD_OPEN_TIME = 10
local SOUND_DELAY = 2

local car = script.Parent
local model = car.Parent
local leftSide = model.Left
local openValue = model.Open
local soundDO = car.DO
local soundDC = car.DC

local seat = car.Bogie.Seats.MainSeat

local tweens = {}
local operating = false

local function cancelTweens()
for _, t in tweens do t:Cancel() end
tweens = {}
end

local function operateDoors()
if operating then return end
operating = true

-- Wait for throttle to be zero before anchoring
repeat task.wait(0.1) until seat.Throttle == 0

-- Anchor the train
for _, part in car:GetDescendants() do
    if part:IsA("BasePart") then
        part.Anchored = true
    end
end
fierce wing
#

So the issue is that one of the doors animate into the wrong direction right?

low topaz
#

-- Wait for physics to calm down
task.wait(WAIT_BEFORE_DOORS)

soundDO:Play()

local sideName = leftSide.Value and "L" or "R"
local sideGroup = car:WaitForChild(sideName)
local popModel = sideGroup:WaitForChild("Pop")
local openModel = sideGroup:WaitForChild("Open")

local doorData = {}

-- Capture the CURRENT state of the doors and the targets (fresh every cycle)
for _, panel in sideGroup:GetChildren() do
    if panel:IsA("Model") and (panel.Name == "L" or panel.Name == "R") then
        local popTarget = popModel:FindFirstChild(panel.Name)
        local openTarget = openModel:FindFirstChild(panel.Name)

        if popTarget and openTarget then
            doorData[panel] = {
                startCF = panel:GetPivot(), -- current door pos (fresh!)
                popCF = popTarget:GetPivot(), -- current pop target (fresh!)
                openCF = openTarget:GetPivot() -- current open target (fresh!)
            }
            print("[DOOR] "..panel.Name.." startCF:", panel:GetPivot())
            print("[DOOR] "..panel.Name.." popCF:", popTarget:GetPivot())
            print("[DOOR] "..panel.Name.." openCF:", openTarget:GetPivot())
        end
    end
end

-- Pop tween
local cfValues = {}

for panel, data in doorData do
    local cf = Instance.new("CFrameValue")
    cf.Value = data.startCF -- Reset to fresh starting point!
    cf.Changed:Connect(function(v)
        panel:PivotTo(v)
    end)
    cf.Parent = panel
    cfValues[panel] = cf
low topaz
#

bro

#

just install it

fierce wing
#

I cant

low topaz
#

istg this aint rocket science

fierce wing
#

My phone not support

low topaz
#

wdym

#

click instqall

fierce wing
#

I got an old phone

low topaz
#

and how it going to ruin it

fierce wing
#

Idk imploding

low topaz
#

wait wait

#

i recommend you

#

to install it

fierce wing
#

You are doing it correctly

#

The script

#

Gj on that

low topaz
#

then why the hell is it offseting on preset models

fierce wing
#

I mean one of the doors is sliding the wrong way right?

low topaz
#

PRESET MODELS, every door cycle, it resets all to nil, and then refreshes to open which is target and start which is itself

#

nah, all of them

#

so one is going inward to the train (1 stud) and outward (1 stud) and if i just add 1 stud or subtract 1 stud, thats overly specfic, because thats just fixing one problem

fierce wing
#

I dont get the issue like whats breaking?

low topaz
#

its offseting

fierce wing
#

Oh yh

ionic walrus
#

holy ai scripting

charred cradleBOT
#

studio** You are now Level 11! **studio

low topaz
#

on f**fing PRESETS MODEL

#

its just A to B

fierce wing
#

Might be bc one of the parts allignorientation is in a different direction

low topaz
#

well

#

maybe

#

because this is a train it rotates

fierce wing
#

Idk man

low topaz
#

but this aint about world space

#

its local scpae

#

space*

low topaz
#

this gen is almost ai

#

as i can say

fierce wing
#

So

low topaz
#

no, just look at this part:

ionic walrus
low topaz
#

bro

fierce wing
#

What I'm seeing is that its gun add the pos to localspace which can be affected by localorientation

low topaz
#

everyone has atleast used ai once

ionic walrus
#

used ai is different to letting ai code for you

#

no wonder theres issues

low topaz
#

issues

#

you need to understand the context

fierce wing
#

It dont matter if u use ai or not

low topaz
#

i read every part of the code

fierce wing
#

We just need to fix it

low topaz
#

AND its using preset models

#

so its using: local popTarget = popModel:FindFirstChild(panel.Name)
local openTarget = openModel:FindFirstChild(panel.Name)

        if popTarget and openTarget then
            doorData[panel] = {
                startCF = panel:GetPivot(), -- current door pos (fresh!)
                popCF = popTarget:GetPivot(), -- current pop target (fresh!)
                openCF = openTarget:GetPivot() -- current open target (fresh!)
            }
            print("[DOOR] "..panel.Name.." startCF:", panel:GetPivot())
            print("[DOOR] "..panel.Name.." popCF:", popTarget:GetPivot())
            print("[DOOR] "..panel.Name.." openCF:", openTarget:GetPivot())
        end
#

yet it happens to be offset???!

#

this one is the one who gets the cframe or pivot: startCF = panel:GetPivot()
popCF = popTarget:GetPivot()
openCF = openTarget:GetPivot(), but wth

fierce wing
#

Honestly pretty weird code you could prpb improve this by just running 1 loop that opens and closes it

low topaz
#

so

#

okay it opens and closes

#

what if we need it to tilt it or rotate it

fierce wing
#

Do the same tweem but add a vector3 to local position

#

Of the door

#

If ya wanna tilt or rot it do it also with local rotation

low topaz
#

then

fierce wing
#

If u want u can also ask ai to implement it

low topaz
#

thats the same thing: startCF = panel:GetPivot()

#

panel is the door

fierce wing
#

Hm

#

That might be world pivot?

#

Hold on

low topaz
#

and just wait

#

it forgets every last pivot

#

and refreshes

#

and these offsets happen outta nowhere

#

even crazier it uses preset models that dont move an inch

#

who the hell is trolling

fierce wing
#

U can use toobjectspace

#

Basically do: parentofpart:toobjectspace(part:getpivot())

#

Idk man u got weird script going on

#

Idk why its messing it up ngl

#

So this is just a guess

low topaz
#

Then apply it like this during the tween:
cf.Changed:Connect(function(v)
panel:PivotTo(car:GetPivot() * v)
end)

#

oh

fierce wing
#

Yh 🙏😭

#

Its either that or just change a positive to a negative

#

Should be the Z in your case (object space)

fierce wing
#

But yeah id say either that but if i were u id ask ai