Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Blast door script works in studio but doesn't work while playing in game?

Greetings,

So I've been making a tweening script for a pressurized blast door which first depressurizes, then it opens. The thing is, it seems to work while I'm testing in studio, but when I join in-game, it doesn't even print anything. Is there a reason why it does that?

local TweenService = game:GetService("TweenService")

local TweeningInfo = TweenInfo.new(
	1,	
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.InOut,
	0,
	false,
	0
)

local Debounce = false

local Model = script.Parent.Parent
local Up = Model:WaitForChild("PressurisedDoorUp")
local Down = Model:WaitForChild("PressurisedDoorDown")
local Left = Model:WaitForChild("PressurisedDoorDecouplersLeft")
local Right = Model:WaitForChild("PressurisedDoorDecouplersRight")

local UpOpen = {CFrame = CFrame.new(51.903,20.667,-0.961) * CFrame.fromEulerAnglesYXZ(math.rad(-90),math.rad(0),math.rad(0))}
local DownOpen = {CFrame = CFrame.new(51.903,-2.483,-0.961) * CFrame.fromEulerAnglesYXZ(math.rad(90),math.rad(0),math.rad(0))}
local LeftOpen = {CFrame = CFrame.new(51.928,8.334,-20.036) * CFrame.fromEulerAnglesYXZ(math.rad(-17.5),math.rad(180),math.rad(0))}
local RightOpen = {CFrame = CFrame.new(51.928,8.334,18.064) * CFrame.fromEulerAnglesYXZ(math.rad(-17.5),math.rad(0),math.rad(0))}

local UpClosed = {CFrame = CFrame.new(51.903,13.042,-0.961) * CFrame.fromEulerAnglesYXZ(math.rad(-90),math.rad(0),math.rad(0))}
local DownClosed = {CFrame = CFrame.new(51.903,5.167,-0.961) *CFrame.fromEulerAnglesYXZ(math.rad(90),math.rad(0),math.rad(0))}
local LeftClosed = {CFrame = CFrame.new(51.928,8.334,-14.336) * CFrame.fromEulerAnglesYXZ(math.rad(-17.5),math.rad(180),math.rad(0))}
local RightClosed = {CFrame = CFrame.new(51.928,8.334,12.439) * CFrame.fromEulerAnglesYXZ(math.rad(-17.5),math.rad(0),math.rad(0))}

local TweenUpClosed = TweenService:Create(Up,TweeningInfo,UpClosed)
local TweenDownClosed = TweenService:Create(Down,TweeningInfo,DownClosed)
local TweenLeftClosed = TweenService:Create(Left,TweeningInfo,LeftClosed)
local TweenRightClosed = TweenService:Create(Right,TweeningInfo,RightClosed)

local TweenUpOpen = TweenService:Create(Up,TweeningInfo,UpOpen)
local TweenDownOpen = TweenService:Create(Down,TweeningInfo,DownOpen)
local TweenLeftOpen = TweenService:Create(Left,TweeningInfo,LeftOpen)
local TweenRightOpen = TweenService:Create(Right,TweeningInfo,RightOpen)

script.Parent.Touched:Connect(function(Hit)
	if not Debounce then
		print("Works")
		Debounce = true
		if Hit.Parent:FindFirstChild("Humanoid") then
			Depressurizing()
			wait(2)
			Model.Depressurizing.Slide:Play()
			TweenLeftOpen:Play()
			TweenRightOpen:Play()
			Model.Depressurizing.Slide:Stop()
			wait(2)
			Model.Depressurizing.Slide:Play()
			TweenUpOpen:Play()
			TweenDownOpen:Play()
			Model.Depressurizing.Slide:Stop()
			wait(10)
			Model.Depressurizing.Slide:Play()
			TweenUpClosed:Play()
			TweenDownClosed:Play()
			Model.Depressurizing.Slide:Stop()
			wait(2)
			Model.Depressurizing.Slide:Play()
			TweenLeftClosed:Play()
			TweenRightClosed:Play()
			Model.Depressurizing.Slide:Stop()
		end
		Debounce = false
	end
end)

function Depressurizing()
	local Depressure = Model:WaitForChild("Depressurizing")
	for i,v in pairs(Depressure:GetChildren()) do
		if v.Name == "ParticleEmitter" then
			v.Enabled = true
		end
	end
	Depressure.Pressure:Play()
	wait(3)
	for i,v in pairs(Depressure:GetChildren()) do
		if v.Name == "ParticleEmitter" then
			v.Enabled = false
		end
	end
	Depressure.Pressure:Stop()
end

This is the door's hierarchy: Hierarchy

1 answer

✓ Accepted answer

are you shure you saved an published everething correctly

1 comment

0

Yes, I checked in-game aswel

This discussion is preserved as it was. New answers, comments, and votes are closed.