Tween isnt playing,

  1. What do you want to achieve? A tweening double door for a SCPF group.

  2. What is the issue? The tween is not playing, The the parts are all welded, + a primary part is set.

  3. What solutions have you tried so far? I’ve looked on the dev forum for possible solutions, and have not found any.

local function DoubleDoorFunction()
	if CS:GetTagged("DoubleDoor") then
		for _,Tags in pairs(CS:GetTagged("DoubleDoor")) do
			Tags:FindFirstChild("Detection").ProximityPrompt.Triggered:Connect(function(plr)
				local StatusOfDoor = Tags:FindFirstChild("Open?")
				-- Setting Permissions for later on
				local Permissions = require(Tags:FindFirstChild("Permissions"))
				
				local TweenInformation = TweenInfo.new(
					4,
					Enum.EasingStyle.Sine,
					Enum.EasingDirection.Out,
					0,
					true,
					0.5)
				
				
				if StatusOfDoor.Value == false then
					StatusOfDoor.Value = true
					if not Debounce then
						Debounce = true
						TweenService:Create(Tags.Door1.PrimaryPart, TweenInformation, {Orientation = Tags.Door1.Closed.Orientation}):Play()
						TweenService:Create(Tags.Door2.PrimaryPart, TweenInformation, {Orientation = Tags.Door2.Closed.Orientation}):Play()
						
						Sounds.BlastDoorOpen:Play()
						Success:FireClient(plr)

						Debounce = false 
					end	
				else
					if not Debounce then
						Debounce = true
						local tween = TweenService:Create(Tags.Door1.PrimaryPart, TweenInformation, {Position = Tags.Door1.Closed.Position})
						local tween2 = TweenService:Create(Tags.Door2.PrimaryPart, TweenInformation, {Position = Tags.Door2.Closed.Position})
						tween:Play()
						tween2:Play()
						Sounds.BlastDoorOpen:Play()
						Success:FireClient(plr)

						Debounce = false 
					end
				end
			end)
		end
	end
end


local BlastDoor = CS:GetInstanceAddedSignal("BlastDoor")
local DoubleDoor = CS:GetInstanceAddedSignal("DoubleDoor")

BlastDoor:Connect(BlastDoorFunction())
DoubleDoor:Connect(DoubleDoorFunction())
1 Like

Doesn’t this need to be:

BlastDoor:Connect(BlastDoorFunction)
DoubleDoor:Connect(DoubleDoorFunction)
2 Likes

It is working without those, however let me try that real quick.

Yeah, I just switched it to those, still same result, the door isnt tweening.

From what I can tell the tweening part is fine, It is most likely something else in your script not working. An easy way to figure out the issue is to add prints after any major part of the code(if statement, event, etc.) if a print statement does not play, then you know where the issue is.

1 Like

The third parameter of the tween create where you are declaring the position or the orientation, i have not seen it like that usually… normally its set with a variable starting position and then the tween moves it to the declared position in the third parameter. See the example in the API here under Tween Creation:

It looks from the tween create lines you have that it is moving the tween to the existing position of the part:

Same for Orientation.

I don’t believe that matters, for example I ran this code:

game:GetService("TweenService"):Create(script.Parent, TweenInfo.new(10), {Orientation = Vector3.new(10,50,10)}):Play()

and It worked perfectly fine.

Right but you gave it a new vector position, or am i not thinking clearly?

you should be setting a cframe instead of orientation or position you can use a part as the base hinge for each door then rotate the CFrame using CFrame.Angles() weld the door with no anchor to the hinge part

Could you give an example of CFrame.Angles being used with orientation?

an Orientation returns a vector3, I see no reason defining one would make a difference.

depends on the doors start rotation but something like
local OriginalDoorCFrame = Door.CFrame – get this on initial run there are a few way to use this

OriginalDoorCFrame * CFrame.Angles(math.rad(45), 0, 0) this would open it 45 degrees if that is the open rotation to tween back close just set back to OriginalDoorCFrame