You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
On Part not touching stove anymore. turn variable to false -
What is the issue? Include screenshots / videos if possible!
it keeps counting even though the variable is false -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Devfourms
This is proberly really easy to fix. im just way to dumb to figure it out.
Code:
local part = script.Parent
local Stove = workspace.Map.Interactables.Stove.Stove
local value = 0
local isTouching = false
local debounce = false
local soundDB = false
part.Touched:Connect(function(hit)
if hit == Stove and debounce == false then
debounce = true
isTouching = true
warn("Meat Touched Stove")
while isTouching == true do
task.wait()
if value < 20 then
task.wait(1.5)
value += 1
debounce = false
warn(value)
end
end
end
end)
while true do
task.wait()
if value == 5 then
task.wait()
--warn("Cooked Patty!")
part.BrickColor = BrickColor.new("Dark orange")
part.Material = Enum.Material.Concrete
end
if value == 10 then
task.wait()
--warn("Burnt Patty :(")
part.BrickColor = BrickColor.new("Really black")
part.Material = Enum.Material.Concrete
end
if isTouching == true then
if soundDB == false then
soundDB = true
script.Parent.Sizzling:Play()
end
else
if soundDB == true then
soundDB = false
script.Parent.Sizzling:Stop()
end
end
end
part.TouchEnded:Connect(function(hit)
if hit == Stove then
isTouching = false
end
end)