Valve Opening Animation Doesn't work

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? So, I am making an SCP-008 and I wanted to make animation for it to open, but valve opening animation doesn’t work, only second part which is opening the main part

  2. What is the issue? SCPs - Roblox Studio 2022-03-12 17-27-28.mp4 - Google Drive

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? No

local prompt = script.Parent.Lid:WaitForChild("Valve").ProximityPrompt
local tween = game:GetService("TweenService")
local beingMade = false
local playOpeningSound = false
local sounds = {
	Open = script.Parent.Lid.Valve.Open,
	Opening = script.Parent.Lid.Valve.Opening
}

function OpeningValveSoundLoopStart()
	playOpeningSound = true
	sounds.Opening:Play()
	repeat until playOpeningSound == true
	sounds.Opening:Stop()
	playOpeningSound = false
end

prompt.Triggered:Connect(function(plr)
	if beingMade then return end
	beingMade = true
	local opened = script.Parent.Opened
	if opened.Value == false then
		local valveOpen = tween:Create(script.Parent.Lid.Valve, TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 3), {CFrame = script.Parent.Lid.Valve.CFrame * CFrame.Angles(0, math.rad(360), 0)})
		OpeningValveSoundLoopStart()
		valveOpen:Play()
		valveOpen.Completed:Wait()
		playOpeningSound = false
		local open = tween:Create(script.Parent.Lid.Hinge, TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CFrame = script.Parent.Lid.Hinge.CFrame * CFrame.Angles(math.rad(-90),0, 0)})
		open:Play()
		sounds.Open:Play()
		open.Completed:Wait()
		beingMade = false
		opened.Value = true
	elseif opened.Value == true then
		beingMade = true
		local open = tween:Create(script.Parent.Lid.Hinge, TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CFrame = script.Parent.Lid.Hinge.CFrame * CFrame.Angles(math.rad(90),0, 0)})
		open:Play()
		open.Completed:Wait()
		local valveOpen = tween:Create(script.Parent.Lid.Valve, TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 3), {CFrame = script.Parent.Lid.Valve.CFrame * CFrame.Angles(0, math.rad(360), 0)})
		valveOpen:Play()
		OpeningValveSoundLoopStart()
		valveOpen.Completed:Wait()
		playOpeningSound = false
		beingMade = false
		opened.Value = true
	end
end)

2 Likes

All of the tween stuff inside of the variables seem good,
are there any errors perhaps?

It could also be that a variable you put an if statement on isn’t set what it is supposed to be (true or false),
a tip is to print out the variables before the if statement to see exactly what is going on.

Another thing:

It doesn’t have to do with that it isn’t opening right now but for an upcoming bug set this value to false,
you’re trying to set the open value to true… while it already is true so just a heads up.