You can write your topic however you want, but you need to answer these questions:
-
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
-
What is the issue? SCPs - Roblox Studio 2022-03-12 17-27-28.mp4 - Google Drive
-
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)