I have problem. I can’t tween an object twice, I’ve read like a lot of posts about this problem but there solution is to always put all the properties into one table. I know this already but my case is different. I want to tween a door to open with one proximity prompt that is enabled and when the door is open, I want that prompt to disable itself and enable a closing prompt which closes the door. I have tried achieving this by putting two separate scripts for each prompt/tween but it isn’t working.
Workspace:
Script Open:
local door = script.Parent
local proximityOpen = door.Open
proximityOpen.Enabled = true
local proximityClose = door.Close
proximityClose.Enabled = false
local TweenService = game:GetService("TweenService")
--/ Tween for opening the door --/
local tweenInfoOpen = TweenInfo.new(
1,
Enum.EasingStyle.Cubic,
Enum.EasingDirection.Out,
0,
false,
0
)
local propTweenOpen = {
Orientation = Vector3.new(0, 90, 0),
Position = Vector3.new(18.043, 4.5, 8.983)
}
local tweenOpen = TweenService:Create(door, tweenInfoOpen, propTweenOpen)
--/ Proximity prompts for opening the door --/
if proximityOpen.Enabled == true then
proximityOpen.Triggered:Connect(function()
tweenOpen:Play()
proximityClose.Enabled = true
proximityOpen.Enabled = false
end)
end
Script Close:
local door = script.Parent
local proximityPromptOpen = door.Open
local proximityPromptClose = door.Close
local TweenService = game:GetService("TweenService")
local tweenInfoClose = TweenInfo.new(
1,
Enum.EasingStyle.Cubic,
Enum.EasingDirection.In,
0,
false,
0
)
local propTweenClose = {
Orientation = Vector3.new(0, 0, 0),
Position = Vector3.new(16.554, 4.5, 10.983)
}
local tweenClose = TweenService:Create(door, tweenInfoClose, propTweenClose)
if proximityPromptClose.Enabled == true then
proximityPromptClose.Triggered:Connect(function()
tweenClose:Play()
proximityPromptClose.Enabled = false
proximityPromptOpen.Enabled = true
end)
end
I am not asking for anyone to make scripts for me, just please tell me how I can tween the door twice.