So I’m making a puzzle where you have to light a brazier that swings and you need to push it around to the ones standing in order to tween a gate open. I put a script inside the main gate’s part so basically if both of the brazier’s fire particle has “Enabled” set to true, make the gate’s tween play. For some reason though the tween isn’t working yet shows no errors in the output. I was wondering if someone could help explain what’s going on?
clip of what’s going on:
The setup inside the Workspace model
The script inside “MovingGate” part
local LeftBrazzierFire = game.Workspace.leftbrazier.Effects.Fire
local RightBrazzierFire = game.Workspace.rightbrazier.Effects.Fire
local TweenService = game:GetService("TweenService")
local gate = script.Parent
local GateMovingTween = TweenService:Create(gate, TweenInfo.new(5.47524, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {CFrame = gate.CFrame * CFrame.new(0,-30,0)}) -- How long the Tween lasts
if LeftBrazzierFire.Enabled == true and RightBrazzierFire.Enabled == true then
GateMovingTween:Play()
script:Destroy()
end
Super simple, I’m not sure why it’s not working though if there’s no errors or anything relating to the script gone wrong in the output. I’d appreciate some help!!
Your ‘if statement’ runs at the start of the script. And yes, it only runs once.
The way to solve this is to keep checking every time something changes:
local LeftBrazzierFire: Fire = game.Workspace.leftbrazier.Effects.Fire
local RightBrazzierFire = game.Workspace.rightbrazier.Effects.Fire
local TweenService = game:GetService("TweenService")
local gate = script.Parent
local GateMovingTween = TweenService:Create(gate, TweenInfo.new(5.47524, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {CFrame = gate.CFrame * CFrame.new(0,-30,0)}) -- How long the Tween lasts
LeftBrazzierFire:GetPropertyChangedSignal("Enabled"):Connect(function()
if LeftBrazzierFire.Enabled and RightBrazzierFire.Enabled then
GateMovingTween:Play()
script:Destroy()
end
end)
local LeftBrazzierFire: Fire = game.Workspace.leftbrazier.Effects.Fire
local RightBrazzierFire = game.Workspace.rightbrazier.Effects.Fire
local TweenService = game:GetService("TweenService")
local gate = script.Parent
local GateMovingTween = TweenService:Create(gate, TweenInfo.new(5.47524, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {CFrame = gate.CFrame * CFrame.new(0,-30,0)}) -- How long the Tween lasts
warn("script ran!")
LeftBrazzierFire:GetPropertyChangedSignal("Enabled"):Connect(function()
warn("triggered")
if LeftBrazzierFire.Enabled and RightBrazzierFire.Enabled then
warn("success!")
GateMovingTween:Play()
script:Destroy()
else
warn("oh")
end
end)
Looks like everything you wrote in the parenthesis printed except for “success!”. I’m assuming the script is still having a hard time detecting if both particles are enabled at the same time?
local LeftBrazzierFire: Fire = game.Workspace.leftbrazier.Effects.Fire
local RightBrazzierFire = game.Workspace.rightbrazier.Effects.Fire
local TweenService = game:GetService("TweenService")
local gate = script.Parent
local GateMovingTween = TweenService:Create(gate, TweenInfo.new(5.47524, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {CFrame = gate.CFrame * CFrame.new(0,-30,0)}) -- How long the Tween lasts
local function Tween()
if LeftBrazzierFire.Enabled and RightBrazzierFire.Enabled then
GateMovingTween:Play()
script:Destroy()
end
end
LeftBrazzierFire:GetPropertyChangedSignal("Enabled"):Connect(Tween)
RightBrazzierFire:GetPropertyChangedSignal("Enabled"):Connect(Tween)