I am pretty clueless on how to tween a door around a hinge, door works perfectly just does not move around the hinge.
local TweenService = game:GetService("TweenService")
local model = script.Parent
local first = model.First.Union
local prompt = model.Card1.Detector1.Attachment.ProximityPrompt
local tweenInfo = TweenInfo.new(1)
local Open = {}
local Closed = {}
Open.CFrame = first.CFrame * CFrame.Angles(0, math.rad(90), 0)
Closed.CFrame = first.CFrame
local Open = TweenService:Create(first, tweenInfo, Open)
local Closed = TweenService:Create(first, tweenInfo, Closed)
prompt.Triggered:Connect(function(player)
if prompt.ActionText == "Close" then
Open:Play()
prompt.ActionText = "Open"
else
Closed:Play()
prompt.ActionText = "Close"
end
end)
This is my script you can use it if you want, its better i think.
local model = script.Parent
local first = model.PrimaryPart
local prompt = model.Card1.Detector1.Attachment.ProximityPrompt
local opened = false
function OpenDoor()
if opened == false then
opened = true
for i = 1, 21 do
script.Parent:SetPrimaryPartCFrame(first.CFrame*CFrame.Angles(math.rad(5), 0, 0))
wait()
end
else
opened = false
for i = 1, 21 do
script.Parent:SetPrimaryPartCFrame(first.CFrame*CFrame.Angles(math.rad(-5), 0, 0))
wait()
end
end
end
prompt.Triggered:Connect(OpenDoor)