hello, this is my first post and i am making a proximity prompt multiparts door, made of meshes, welded with the Weld Model plugin, but ihave issues, the script doesn´t work, i am new to scripting but i understand some things, i followed a tutorial on the door, but i haven´t been able to make it work, i would appreciate any advice on this, thanks!
local TweenService = game:GetService("TweenService")
local door = script.Parent
local doorHinge = door.PrimaryPart
local doorOpen = TweenInfo.new()
--Names the Variables
local doorCFrame = TweenService:Create(doorHinge, doorOpen, {
CFrame = doorHinge.CFrame * CFrame.Angles(0, math.rad(-100),0) --change previous angle (0) to whatever value for the range of swing.
})
local doorCframeClosed = TweenService:Create(doorHinge, doorOpen, {
CFrame = doorHinge.CFrame * CFrame.Angles(0, math.rad(0),0) --changes the -100 to 0 value to close the door
})
local ProximityPrompt = script.Parent.ProximityPrompt
local PromptVanish = ProximityPrompt.Enabled == false
local PromptAppear = ProximityPrompt.Enabled == true
ProximityPrompt.Triggered:Connect(function(
doorCFrame:Play()
ProximityPrompt.Enable = false
script.Parent.Open:Play()--play the open sound
task.wait(3) --door stays open for this long
doorCframeClosed:Play()
ProximityPrompt.Enabled = true
task.wait(1)
script.Parent.Close:Play()
end)