I'm trying to make a temperature system and basically when temperature reaches 100 an explosion will happen or when temperature reaches 0 something else will happen. But it doesn't do what it's told to do when I use "if" and "then" it just ignores them. I also get no errors so the script runs perfectly. Look at line 104 and 129.
local SP = script.parent
local D = SP.Demat2
local CD = D.Demat3.ClickDetector
local isUp = SP.isUp
local isDown = SP.isDown
local InFlight = SP.InFlight
local OutFlight = SP.OutFlight
local C = SP.parent.parent
local tweenService = game:GetService("TweenService")
local tweeningInformation = TweenInfo.new(
0.5, -- Time
Enum.EasingStyle.Bounce, -- Easing Style
Enum.EasingDirection.Out, -- Easing Direction
0, -- Number of times it repeats
false, -- If it reverts
0
)
local partProperties = {
Position = Vector3.new(0.245, 6.466, 54.513)
}
local Tween7 = tweenService:Create(D.Demat3, tweeningInformation,partProperties)
local partProperties = {
Position = Vector3.new(0.497, 6.266, 54.287);
CFrame = D.Part1.CFrame * CFrame.Angles(0, -60, 0)
}
local Tween8 = tweenService:Create(D.Part1, tweeningInformation,partProperties)
local partProperties = {
Position = Vector3.new(0.008, 6.266, 54.287);
CFrame = D.Part2.CFrame * CFrame.Angles(0, -60, 0)
}
local Tween9 = tweenService:Create(D.Part2, tweeningInformation,partProperties)
local partProperties = {
Position = Vector3.new(0.499, 6.466, 54.514)
}
local Tween10 = tweenService:Create(D.Part3, tweeningInformation,partProperties)
local partProperties = {
Position = Vector3.new(0.248, 6.466, 54.514)
}
local Tween11 = tweenService:Create(D.Part4, tweeningInformation,partProperties)
local partProperties = {
Position = Vector3.new(0.009, 6.466, 54.514)
}
local Tween12 = tweenService:Create(D.Part5, tweeningInformation,partProperties)
local partProperties = {
Position = Vector3.new(0.245, 6.153, 53.309)
}
local Tween = tweenService:Create(D.Demat3, tweeningInformation,partProperties)
local partProperties = {
Position = Vector3.new(0.497, 6.016, 53.615);
CFrame = D.Part1.CFrame * CFrame.Angles(0, 30, 0)
}
local Tween2 = tweenService:Create(D.Part1, tweeningInformation,partProperties)
local partProperties = {
Position = Vector3.new(0.008, 6.016, 53.615);
CFrame = D.Part1.CFrame * CFrame.Angles(0, 30, 0)
}
local Tween3 = tweenService:Create(D.Part2, tweeningInformation,partProperties)
local partProperties = {
Position = Vector3.new(0.499, 6.156, 53.305)
}
local Tween4 = tweenService:Create(D.Part3, tweeningInformation,partProperties)
local partProperties = {
Position = Vector3.new(0.248, 6.156, 53.305)
}
local Tween5 = tweenService:Create(D.Part4, tweeningInformation,partProperties)
local partProperties = {
Position = Vector3.new(0.009, 6.156, 53.305)
}
local Tween6 = tweenService:Create(D.Part5, tweeningInformation,partProperties)
CD.MouseClick:Connect(function()
if isUp.Value == 1 then
Tween:Play()
Tween2:Play()
Tween3:Play()
Tween4:Play()
Tween5:Play()
Tween6:Play()
SP.Lever:Play()
isUp.Value = 0
isDown.Value = 1
InFlight.Value = 1
OutFlight.Value = 0
SP.TakeOff:Play()
while InFlight.Value == 1 do
wait(1)
if SP.TMP.Value == 100 then
local Explosion1 = Instance.new("Explosion",C.TimeRotor.Core.Part2)
Explosion1.DestroyJointRadiusPercent = 0
Explosion1.Position = C.TimeRotor.Core.Part2
Explosion1:Destroy()
end
SP.TMP.Value = SP.TMP.Value + 10
SP.Parent.TMP.SurfaceGui.TextLabel.Text = SP.TMP.Value
end
C.TimeRotor.TheChonkChart.Script.Disabled = false
else
Tween7:Play()
Tween8:Play()
Tween9:Play()
Tween10:Play()
Tween11:Play()
Tween12:Play()
SP.Lever:Play()
isUp.Value = 1
isDown.Value = 0
InFlight.Value = 0
OutFlight.Value = 1
SP.Land:Play()
while OutFlight.Value == 1 do
wait(1)
if SP.Parent.TMP.SurfaceGui.TextLabel.Text == 0 then
OutFlight.Value = 2
SP.Parent.TMP.SurfaceGui.TextLabel.Text = "TMP: 0"
return
end
SP.TMP.Value = SP.TMP.Value - 10
SP.Parent.TMP.SurfaceGui.TextLabel.Text = SP.TMP.Value
end
C.TimeRotor.TheChonkChart.Script.Disabled = true
end
end)

2 comments
Did you test it in ROBLOX studio or in an actual server?
roblox studio