How to make it where you can accidentally burn food when cooking?
Asked by
5 years ago Edited 5 years ago
I am making a cooking game and I want to make it where if you click it in time, then it gives you a bacon tool or something, but if you don't, in five seconds, it will burn. I already made the burning part but I don't know how to make it where, like I said, if you don't get it in five seconds then it happens. Thanks!
Here is the script:
03 | local ToolNames = { "CookedBacon" , "Item" , "Item" } |
04 | local Storage = game:GetService( "ServerStorage" ) |
07 | local Part = script.Parent |
08 | local ClickDetector = Part:WaitForChild( "ClickDetector" ) |
10 | ClickDetector.MouseClick:connect( function (Player) |
11 | if Player and Player.Character then |
12 | local Backpack = Player:WaitForChild( "Backpack" ) |
13 | for i = 1 , #ToolNames do |
14 | local Tool = Storage:FindFirstChild(ToolNames [ i ] ) |
16 | Tool:clone().Parent = Backpack |
17 | script.Parent.Transparency = 1 |
18 | script.Parent.SurfaceGui.Enabled = false |
19 | script.Parent.Parent.Transparency = 1 |
20 | script.Parent.Parent.Baconn.Transparency = 1 |
23 | script.Parent.SurfaceGui.TextLabel.Text = "BURNT" |
24 | script.Parent.Parent.BurntBacon.Transparency = 0 |
25 | script.Parent.Parent.BurntBacon.Smoke.Enabled = true |
26 | script.Parent.Parent.Baconn.Transparency = 1 |
36 | script.Parent.ClickDetector.MouseClick:connect(onClicked) |