local function z(z,p)if z.Character and z.Character:FindFirstChild("\084\111\114\115\111")then local p=z.Character:FindFirstChild("\084\111\114\115\111")local R=p.Position-stove.Door.Position if R.magnitude<clickDistance then if open then ovenMotor.DesiredAngle=0 open=false else ovenMotor.DesiredAngle=math.pi/2 open=true end end end end stove.DoorPadding.ROBLOXInteractionEvent.OnServerEvent:connect(function(p,R)z(p)end)stove.Door.ROBLOXInteractionEvent.OnServerEvent:connect(function(p,R)z(p)end)
-- Handle event fire
local function toggleDoor(player, door)
	-- Check distance to the character's Torso. If too far, don't do anything
	if player.Character and player.Character:FindFirstChild("Torso") then
		local torso = player.Character:FindFirstChild("Torso")
		local toTorso = torso.Position - stove.Door.Position
		if toTorso.magnitude < clickDistance then
			if open then
				ovenMotor.DesiredAngle = 0
				open = false
			else
				ovenMotor.DesiredAngle = math.pi / 2
				open = true
			end
		end
	end
end

stove.DoorPadding.ROBLOXInteractionEvent.OnServerEvent:connect(function(player, arguments)
	toggleDoor(player)
end)

stove.Door.ROBLOXInteractionEvent.OnServerEvent:connect(function(player, arguments)
	toggleDoor(player)
end)
