Hello, I’m currently working on a universal door system for Vehicles in my game, the door system that I’ve
made uses Motor6D for Moving a part I labeled “A”, and has a base part I labeled “B”.
And there’s a proximity prompt that when triggered is meant to tell the script to, play the open animation /“OP” and when triggered again play “Cl”/close animation.
Sorry I didn’t fully elaborate on the problem, but basically I’m getting an error at line “17” of my script and most likely don’t know what I’m doing, plus I’m relatively new to the Dev forums
local Han = script.Parent.Handle
local sound1 = script.Parent.Sound
local sound2 = script.Parent.Sound2
local On = script.Parent.OP
local Of = script.Parent.CL
open = false
script.Parent.ProximityPrompt.Triggered:Connect(function(player)
print(“handle pulled”)
Han:Play()
if open == true then
open = false
On:Play()
wait(.8)
sound2:Play()
else
open = true
Of:Play()
sound1:Play()
end
end)
Of might be a different Object, can you double check your Explorer & see what Of is supposed to be?
Here’s a fixed version:
local Han = script.Parent.Handle
local sound1 = script.Parent.Sound
local sound2 = script.Parent.Sound2
local On = script.Parent.OP
local Of = script.Parent.CL
open = false
script.Parent.ProximityPrompt.Triggered:Connect(function(player)
print("handle pulled")
--Han:Play()
if open == true then
open = false
On:Play()
wait(.8)
sound2:Play()
else
open = true
--Of:Play()
sound1:Play()
end
end)
Thanks for pointing that out, I’ll be sure to attach a photo of the system in the explorer to better clarify
Also, here’s a reference of how this system will function (In-game)
“B” is red, the stationary that the door will ether revolve around or slide from/ like a hinge or prismatic constraint, and “A” is the blue/ Main part of the door, that has the Motor6D that will animate according to what animations play.
all those functions are housed in “Main” or the handle.