Make oven script

  1. What do you want to achieve?
    I want to make kitchen oven which flame player when click on switch
  2. What is the issue?
local plate = script.Parent.Parent.plate
local btn = script.Parent.ClickDetector

btn.MouseClick:Connect(function()
    plate.BrickColor = BrickColor.new("Really red")
    if plate.Parent:FindFirstChild("Humanoid") then
        plate.Parent.Humanoid:TakeDamage(10)
    end
end)

I make condition but its not working
Can you fix my script pls.

work
Here is workspace

1 Like

So you want to make an oven that sets the player on fire when the press the button?

Why would the plate be part of the player’s humanoid???

Either way you need to define which player used the click detector in the function like this:

btn.MouseClick:Connect(function(plr)
      local char = plr.Character or plr.CharacterAdded:Wait()
      local Humanoid = char:WaitForChild("Humanoid")

      if "Put the condition here" then
          Humanoid:TakeDamage(10)
      end
end)

Yeah like this plate is set on fire

Its seems it not working

local plate = script.Parent.Parent.plate
local btn = script.Parent.ClickDetector
local switch = script.Parent
local activated = false

btn.MouseClick:Connect(function(plr)
	local char = plr.Character or plr.CharacterAdded:Wait()
	local Humanoid = char:WaitForChild("Humanoid")
	if not(activated)then
		plate.BrickColor = BrickColor.new("Deep blue")
		switch.BrickColor = BrickColor.new("Really red")
		if Humanoid then
			Humanoid:TakeDamage(10)
		end
		activated = true
	else
		switch.BrickColor = BrickColor.new("Medium stone grey")
		activated = false
	end
end)

I try to make this with plate too but same problem

local plate = script.Parent.Parent.plate
local btn = script.Parent.ClickDetector
local switch = script.Parent
local activated = false

btn.MouseClick:Connect(function(plr)
	local char = plr.Character or plr.CharacterAdded:Wait()
	local Humanoid = char:WaitForChild("Humanoid")
	if not(activated)then
		plate.BrickColor = BrickColor.new("Deep blue")
		switch.BrickColor = BrickColor.new("Really red")
		if plate:FindFirstChild(Humanoid) then
			Humanoid:TakeDamage(10)
		end
		activated = true
	else
		switch.BrickColor = BrickColor.new("Medium stone grey")
		activated = false
	end
end)

if plate.Parent:FindFirstChild(“Humanoid”) then

here you are checking if the oven has a humanoid, not the player

local plate = script.Parent.Parent.plate
local btn = script.Parent.ClickDetector

btn.MouseClick:Connect(function(player) --added the player in brackets basically telling the script who pressed the button
    plate.BrickColor = BrickColor.new("Really red")
    player.Character.Humanoid:TakeDamage(10) --gets the players character and takes damage
end)

you dont need the if statement since only a player with a character and a humanoid can press it

Its just killing me when i click on switch

it works for me. only takes 10 damage. maybe your default health is 10 or lower or you duplicated the script?
burning plate.rbxl (54.1 KB)

@YouthfulPat501 pls read this what I want to achieve

yeah you want the player to take damage and a plate to turn red when you click a button right?

if you mean that you want a fire to be on a player then:

local plate = script.Parent.Parent.plate
local btn = script.Parent.ClickDetector

btn.MouseClick:Connect(function(player)
	fire = Instance.new("Fire")
	fire.Parent = player.Character.HumanoidRootPart
	plate.BrickColor = BrickColor.new("Really red")--added the player in brackets basically telling the script who pressed the button
	player.Character.Humanoid:TakeDamage(10)
	wait(5)
	fire.Enabled = false
	wait(3)
	fire:Destroy()
end)

Yeah player take damage when i turn on oven and plate make “hot” and damage player. Im bad at English

Something like this i trying he have point

local plate = script.Parent.Parent.plate
local btn = script.Parent.ClickDetector

btn.MouseClick:Connect(function(player)
	fire = Instance.new("Fire")
	fire.Parent = player.Character.HumanoidRootPart
	plate.BrickColor = BrickColor.new("Really red")--added the player in brackets basically telling the script who pressed the button
	player.Character.Humanoid:TakeDamage(10)
	wait(5)
	fire.Enabled = false
	wait(3)
	fire:Destroy()
end)

try this

I dont need fire, just damage. I say it simple
I want to make kill brick but killing is happen when i click on other part
So I make something like this

local plate = script.Parent.Parent.plate
local btn = script.Parent.ClickDetector
local switch = script.Parent

btn.MouseClick:Connect(function()
    switch.BrickColor = BrickColor.new("Really red")
    plate.Touched:Connect(function(hit)
        if hit.Parent:FindFirstChild("Humanoid") then
            hit.Parent.Humanoid:TakeDamage(10)
        end
    end)
end)

But some guy told me that function in function is wrong

so you want to make it so the plate gets hot and you take damage from that?

Yeah just like that and you dont need to make fire. Just make kill brick but with switch

@UwUanimsyt Is this script good?