So I fixed some problems with my Toaster. But I realized as I was testing it that I missed a pretty big thing.
So although my improved script prevents the Toaster from turning on while unplugged, it DOESN'T know if it's plugged in or not WHILE it's already on.
So it doesn't shut off while it's running
Here's the script that when you press it it starts the Toaster up:
Plugged = workspace.ToasterCord:WaitForChild("Plugged")
function onClicked(playerWhoClicked)
if Plugged.Value == true then
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, -0.4, 0)
wait(0.7)
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, 0.4, 0)
wait(6)
workspace.Toaster.Heat1.BrickColor = BrickColor.new("Dusty Rose")
workspace.Toaster.Heat2.BrickColor = BrickColor.new("Dusty Rose")
wait(6)
workspace.Toaster.Heat1.BrickColor = BrickColor.Red()
workspace.Toaster.Heat2.BrickColor = BrickColor.Red()
wait(8)
workspace.Toaster.Heat1.BrickColor = BrickColor.new("Really red")
workspace.Toaster.Heat2.BrickColor = BrickColor.new("Really red")
wait(10)
script.Parent.Parent.Base.Smoke.Enabled = true
wait(12)
script.Parent.Parent.Base.Smoke.Opacity = 0.3
wait(30)
script.Parent.Parent.Base.Smoke.Opacity = 1
wait(10)
script.Parent.Parent.Base.Fire.Enabled = true
script.Parent.Parent.Base.PointLight.Enabled = true
if Plugged.Value == false then
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, -0.1, 0)
wait(0.2)
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, 0.1, 0)
end
end
end
