Hi, i was doing an objectives system, but something dont work, more context below:
So i have an objective system, that when you have a soda in the inventory or equiped, and you interact with the stove, it goes on fire and you need to turn it off, but when you turn it on after turning it off, it should cook an egg if you have it, but instead of that, just goes on fire like if you was cooking the soda, what is going on?
i tried to use a new boolVal named “sodaCooked” but it still wont work.
local SG = game:GetService("StarterGui")
local Gui = script.Parent
local Text = Gui.Change
local cookPrompt = workspace.Map.House.Kitchen.Stove.Main.ProximityPrompt
local turnOffPrompt = workspace.Map.House.Kitchen.Stove.Main.Off
local eggPrompt = workspace.Map.House.Kitchen.Stove.Main.Egg
local onFire = true
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local soda = workspace["Bloxy Cola"]
local egg = workspace.Egg
local sodaCooked = false
local tFolder = workspace.Objectives
local t1 = tFolder.Trigger1
local t2 = tFolder.Trigger2
cookPrompt.Triggered:Connect(function()
if soda.Parent == player.Backpack or soda.Parent == char and sodaCooked == false then
Text.Text = "TURN OFF THE STOVE YOU COOKED SODA AGAIN"
cookPrompt.Parent.Spot.Fire.Enabled = true
cookPrompt.Parent.Spot.BillboardGui.Enabled = true
cookPrompt.Enabled = false
turnOffPrompt.Enabled = true
onFire = true
cookPrompt.HoldDuration = 1
elseif soda.Parent == workspace or soda.Parent ~= player.Backpack or soda.Parent ~= char then
Gui.NotCola.Visible = true
sodaCooked = true
wait(2)
for i = 0, 100, .05 do
Gui.NotCola.TextTransparency = i
wait()
end
end
end)
if sodaCooked == true then
cookPrompt.Enabled = false
turnOffPrompt.Enabled = false
eggPrompt.Enabled = true
end
turnOffPrompt.Triggered:Connect(function()
Text.Text = "Cook eggs"
cookPrompt.Parent.Spot.Fire.Enabled = false
cookPrompt.Parent.Spot.BillboardGui.Enabled = false
onFire = false
cookPrompt.Enabled = true
turnOffPrompt.Enabled = false
end)
eggPrompt.Triggered:Connect(function()
if onFire == false and egg == player.Backpack and sodaCooked == true then
Text.Text = "Eat"
end
end)
Text.Text = "Get out of ur room"
t1.Touched:Connect(function(hit)
Text.Text = "Go to the kitchen"
wait(1)
t1:Destroy()
end)
t2.Touched:Connect(function(hit)
Text.Text = "Cook something"
wait(1)
t2:Destroy()
end)
Thanks!
Screenshots:
the GUI: